Files
sx-fc/app/assets/javascripts/reservation.js
2018-12-24 16:58:53 +06:30

64 lines
1.6 KiB
JavaScript

//= require custom.js
$(function(){
$(".room_type").hide();
/*new customer UI func:*/
//Initialize tooltips
$('.nav-tabs > li a[title]').tooltip();
//Wizard
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
var $target = $(e.target);
if ($target.parent().hasClass('disabled')) {
return false;
}
});
$(".next-step").click(function (e) {
var $active = $('.wizard .nav-tabs li a.active');
$active.parent().next().removeClass('disabled');
nextTab($active);
$('.wizard .nav-tabs li.active .connecting-line').css({"border-bottom-left-radius": 0, "border-top-left-radius": 0});
});
$(".prev-step").click(function (e) {
var $active = $('.wizard .nav-tabs li a.active');
prevTab($active);
});
/*new customer UI func:*/
$(".reservation_type").on("click", function(){
if(parseInt($(this).val()) == 0){
$(".dining_type").show();
$(".room_type").hide();
}else{
$(".dining_type").hide();
$(".room_type").show();
}
});
$(".number_limit").on("click", function(){
if(parseInt($(this).val()) <= 0){
if($(this).attr("data-type") == "room"){
$("#room_count").val(1);
}else if($(this).attr("data-type") == "adult"){
$("#adult_count").val(1);
}else{
$("#child_count").val(1);
}
}
});
});
/*customer UI tab btn*/
function nextTab(elem) {
$(elem).parent().next().find('a[data-toggle="tab"]').click();
}
function prevTab(elem) {
$(elem).parent().prev().find('a[data-toggle="tab"]').click();
}
/*customer UI tab btn*/