1.Dados da reserva
2.Veículo
3.Extras
4.Confirmação
').appendTo('body') .html('
') .dialog({ modal: true, title: '', zIndex: 10000, autoOpen: true, width: 'auto', resizable: false, buttons: { Cancel: function() { way2rentals.jQuery(this).dialog("close"); }, Confirm: function() { way2rentals.jQuery('#w2rForm').submit(); way2rentals.jQuery(this).dialog("close"); } }, close: function(event, ui) { way2rentals.jQuery(this).remove(); } }); }; var stations =way2rentals.jQuery.parseJSON('{"3":{"id_local":"4","designation":"Aeroporto Madeira","is_available":"1","id_estacao":"4","working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]},"name":"Aeroporto Madeira","address":"Aeroporto da Madeira","schedule":{"working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]}}},"2":{"id_local":"3","designation":"Cani\u00e7o","is_available":"1","id_estacao":"4","working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]},"name":"Cani\u00e7o","address":"Aeroporto da Madeira","schedule":{"working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]}}},"0":{"id_local":"1","designation":"Funchal","is_available":"1","id_estacao":"4","working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]},"name":"Funchal","address":"Aeroporto da Madeira","schedule":{"working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]}}},"1":{"id_local":"2","designation":"Garajau","is_available":"1","id_estacao":"4","working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]},"name":"Garajau","address":"Aeroporto da Madeira","schedule":{"working_hours":{"seg":[{"begin":"08:00","end":"20:00"}],"ter":[{"begin":"08:00","end":"20:00"}],"qua":[{"begin":"08:00","end":"20:00"}],"qui":[{"begin":"08:00","end":"20:00"}],"sex":[{"begin":"08:00","end":"20:00"}],"sab":[{"begin":"08:00","end":"20:00"}],"dom":[{"begin":"08:00","end":"20:00"}]},"out_of_hours":{"seg":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"ter":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qua":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"qui":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sex":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"sab":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}],"dom":[{"begin":"20:01","end":"23:59","type":"both","object_type":"40","id_object":"1"},{"begin":"00:00","end":"07:59","type":"both","object_type":"40","id_object":"1"}]}}}}'); var allowed_times_pickup = []; var allowed_times_dropoff = []; function nonWorkingDatesPickup(date){ var day = date.getDay(); var closedDates = ['2019-11-12']; var selected_date = way2rentals.jQuery('#pickup_date').val(); var selected_station = way2rentals.jQuery('#pickup').val(); var closedDays = []; time_open = "00"; time_close = "23"; allowed_times_pickup = []; for (i = time_open; i <= time_close; i++) { if(i < 12 || i > 14){ allowed_times_pickup.push(i+":00"); } if(i < 12 || i > 13){ allowed_times_pickup.push(i+":30"); } } way2rentals.jQuery.each( stations, function( key, value ) { if (value.stationid == selected_station){ /*if(value.time_open != "" && value.time_close != ""){ var time_open = value.time_open.split(":"); time_open = time_open[0]; var time_close = value.time_close.split(":"); time_close = time_close[0]; } else { time_open = "00"; time_close = "23"; } */ way2rentals.jQuery.each( value.open_days, function( day_abreviation, status ) { if(status == 0){ switch(day_abreviation) { case "sun": closedDays.push([0]); break case "mon": closedDays.push([1]); break case "tue": closedDays.push([2]); break case "wed": closedDays.push([3]); break case "thu": closedDays.push([4]); break case "fri": closedDays.push([5]); break case "sat": closedDays.push([6]); break } } }); } }) var holidays = way2rentals.jQuery.parseJSON('[]'); var datestring = way2rentals.jQuery.datepicker.formatDate('yy-mm-dd', date); if(holidays.indexOf(datestring) != -1){ return [false]; } for (var i = 0; i < closedDays.length; i++) { if (day == closedDays[i][0]) { return [false]; } } for (i = 0; i < closedDates.length; i++) { if (date.getMonth() == closedDates[i][0] - 1 && date.getDate() == closedDates[i][1] && date.getFullYear() == closedDates[i][2]) { return [false]; } } return [true]; } function nonWorkingDatesDropoff(date){ var day = date.getDay(); var closedDates = []; var selected_station = way2rentals.jQuery('#dropoff').val(); var closedDays = []; allowed_times_dropoff = []; for (i = time_open; i <= time_close; i++) { if(i < 12 || i > 13){ allowed_times_dropoff.push(i+":00"); } if(i < 11 || i > 13){ allowed_times_dropoff.push(i+":30"); } } way2rentals.jQuery.each( stations, function( key, value ) { if (value.stationid == selected_station){ /*if(value.time_open != "" && value.time_close != ""){ var time_open = value.time_open.split(":"); time_open = time_open[0]; var time_close = value.time_close.split(":"); time_close = time_close[0]; } else { time_open = "00"; time_close = "23"; } */ time_open = "00"; time_close = "23"; allowed_times_dropoff = []; for (i = time_open; i <= time_close; i++) { allowed_times_dropoff.push(i+":00"); allowed_times_dropoff.push(i+":30"); } way2rentals.jQuery.each( value.open_days, function( day_abreviation, status ) { if(status == 0){ switch(day_abreviation) { case "sun": closedDays.push([0]); break case "mon": closedDays.push([1]); break case "tue": closedDays.push([2]); break case "wed": closedDays.push([3]); break case "thu": closedDays.push([4]); break case "fri": closedDays.push([5]); break case "sat": closedDays.push([6]); break } } }); } }) var holidays = way2rentals.jQuery.parseJSON('[]'); var datestring = way2rentals.jQuery.datepicker.formatDate('yy-mm-dd', date); if(holidays.indexOf(datestring) != -1){ return [false]; } for (var i = 0; i < closedDays.length; i++) { if (day == closedDays[i][0]) { return [false]; } } for (i = 0; i < closedDates.length; i++) { if (date.getMonth() == closedDates[i][0] - 1 && date.getDate() == closedDates[i][1] && date.getFullYear() == closedDates[i][2]) { return [false]; } } return [true]; } way2rentals.jQuery('#pickup_date').datetimepicker({ format: 'Y-m-d', beforeShowDay: nonWorkingDatesPickup, timepicker:false, minDate:'+1970/01/01', onShow:function( ct ){ this.setOptions({ maxDate: false, }) } }); way2rentals.jQuery('#dropoff_date').datetimepicker({ format:'Y-m-d', timepicker:false, beforeShowDay: nonWorkingDatesDropoff, minDate:'+1970/01/01', onShow:function( ct ){ this.setOptions({ minDate:jQuery('#pickup_date').val()?jQuery('#pickup_date').val():false, }) } }); way2rentals.jQuery('#pickup_hour').datetimepicker({ format: 'H:i', datepicker: false, timepicker:true, closeOnTimeSelect: false, closeOnWithoutClick: true, onShow:function( ct ){ this.setOptions({ maxDate: false, allowTimes: allowed_times_pickup, }) } }); way2rentals.jQuery('#dropoff_hour').datetimepicker({ format: 'H:i', datepicker: false, timepicker:true, closeOnTimeSelect: false, closeOnWithoutClick: true, onShow:function( ct ){ this.setOptions({ maxDate: false, allowTimes: allowed_times_dropoff, }) } });