1 var app = angular.module('staylist', []); 2 var currDate = new Date(); 3 4 app.controller('MyController', function($scope, $http, $window) { 5 $scope.loadOrderList = function() { 6 var custID = localStorage.getItem('twUserID'); 7 console.log (custID); 8 if (custID == "" || custID == null) { 9 $("#loginModal").modal('show'); 10 } else { 11 $http.get("https://www.trawell.in/user-services/rest/customer/get-order-list/" + custID) 12 .then(function(response) { 13 //alert (JSON.stringify(response.data.tour_list)); 14 15 var tourList = response.data; 16 var tempDuration; 17 tourCount = tourList.order_list.length; 18 19 if (tourCount > 0) { 20 //$(document).attr('title', tourCount + " " + tempPageTitle); 21 22 $('.packageCount').html( tourCount + " Booking found!"); 23 24 $('.packageCount').removeClass("hidden"); 25 //alert (tempPageTitle); 26 27 } else { 28 $('.packageCount').html("No Bookings found!"); 29 $('.packageCount').removeClass("hidden"); 30 } 31 32 33 for (i=0; i<tourList.order_list.length; i++) { 34 var ordStatus, ordStatusClass; 35 tourList.order_list[i]["image_path"] = tourList.order_list[i]["image_path"].replace('.jpg','_sm.jpg'); 36 37 var tourDate = new Date(tourList.order_list[i]["travel_date"]); 38 var dateDiff = ((currDate.getTime() - tourDate.getTime())/ 86400000); 39 console.log (dateDiff); 40 if (dateDiff - tourList.order_list[i]["trip_duration"] > 0) { 41 ordStatus = "Completed"; 42 ordStatusClass = "btn-secondary"; 43 } else if (dateDiff < 0) { 44 ordStatus = "Upcoming"; 45 ordStatusClass = "btn-success"; 46 } else { 47 ordStatus = "Ongoing"; 48 ordStatusClass = "btn-primary"; 49 } 50 tourList.order_list[i]["tour_status"] = ordStatus; 51 tourList.order_list[i]["tour_status_class"] = ordStatusClass; 52 53 /* tourList.stay_list[i]["star_rating"] = "/images/" + tourList.stay_list[i]["star_rating"] + "star_new.gif"; 54 tourList.stay_list[i]["disc_fare"] = Math.floor(parseInt(tourList.stay_list[i]["base_fare"]) - (parseInt(tourList.stay_list[i]["base_fare"]) * parseInt(tourList.stay_list[i]["disc_fare"]) / 100)); 55 if (tourList.stay_list[i]["pool"] == "Y") { 56 tourList.stay_list[i]["show_pool"] = ""; 57 } else { 58 tourList.stay_list[i]["show_pool"] = "hidden"; 59 } 60 61 if (tourList.stay_list[i]["restaurant"] == "Y") { 62 tourList.stay_list[i]["show_rest"] = ""; 63 } else { 64 tourList.stay_list[i]["show_rest"] = "hidden"; 65 } 66 67 if (tourList.stay_list[i]["bar"] == "Y") { 68 tourList.stay_list[i]["show_bar"] = ""; 69 } else { 70 tourList.stay_list[i]["show_bar"] = "hidden"; 71 } 72 73 if (tourList.stay_list[i]["wifi"] == "Y") { 74 tourList.stay_list[i]["show_wifi"] = ""; 75 } else { 76 tourList.stay_list[i]["show_wifi"] = "hidden"; 77 } 78 79 if (tourList.stay_list[i]["gym"] == "Y") { 80 tourList.stay_list[i]["show_gym"] = ""; 81 } else { 82 tourList.stay_list[i]["show_gym"] = "hidden"; 83 } 84 85 86 if (tourList.stay_list[i]["type"] == "R") { 87 tourList.stay_list[i]["stay_cat"] = "RESORT"; 88 tourList.stay_list[i]["url"] = "/resorts/" + tourList.stay_list[i]["city"].toLowerCase() + "/" + tourList.stay_list[i]["url"]; 89 } else if (tourList.stay_list[i]["type"] == "HS"){ 90 tourList.stay_list[i]["stay_cat"] = "HOMESTAY"; 91 tourList.stay_list[i]["url"] = "/homestays/" + tourList.stay_list[i]["city"].toLowerCase() + "/" + tourList.stay_list[i]["url"]; 92 } else if (tourList.stay_list[i]["type"] == "HT"){ 93 tourList.stay_list[i]["stay_cat"] = "HOTEL"; 94 tourList.stay_list[i]["url"] = "/hotels/" + tourList.stay_list[i]["city"].toLowerCase() + "/" + tourList.stay_list[i]["url"]; 95 } */ 96 /* tourList.stay_list[i]["it_duration_code"] = tourList.tour_list[i]["it_duration"] + "D"; 97 tourList.stay_list[i]["it_duration"] = tourList.tour_list[i]["it_duration"] + "D/" + (tempDuration - 1) + "N"; 98 tourList.stay_list[i]["it_inclusions"] = inclusionsAll1; 99 tourList.stay_list[i]["it_travel"] = ""; 100 tourList.stay_list[i]["it_accommodation"] = ""; 101 tourList.stay_list[i]["it_offbeat"] = "hidden"; 102 tourList.stay_list[i]["it_offbeat_img"] = "offbeat_blank.png"; */ 103 } 104 $scope.tour_data = tourList.order_list; 105 $("#slider1").removeClass("hidden"); 106 //alert (itDestList); 107 //alert (JSON.stringify(tourList)); 108 //setMetaData (); 109 titleTemp = " My Bookings"; 110 /* if (tourList.tour_list.length > 0) { 111 loadFares (loadRatings); 112 setFilters (); 113 $("div.dest-popular-mn.add-margin > a > img, .tt_bottom img").removeAttr("style"); 114 } */ 115 $(".priceLoading").addClass("hidden"); 116 }); 117 } 118 }; 119 120 $scope.filterPackagesQry = function() { 121 $(".packageItem.slideItem").addClass ("hidden"); 122 var filterValue1 = ""; 123 var filterValue2 = ""; 124 var filterType = ".packageItem.slideItem"; 125 var filterFinal; 126 127 $(".packageAlert").text(""); 128 qStrFrom = getQueryVariable("from"); 129 if (qStrFrom != null) { 130 qStrFrom = qStrFrom.capitalize(); 131 filterValue1 = "." + qStrFrom; 132 //$("#lstTourCity").val(qStrFrom); 133 $("#lstTourCity").select2('data', {id: qStrFrom, text: qStrFrom}); 134 } 135 136 qStrDuration = getQueryVariable("duration"); 137 if (qStrDuration != null) { 138 //qStrDuration = qStrDuration; 139 filterValue2 = "." + qStrDuration + "D"; 140 //$("#lstTourDuration").val(qStrDuration); 141 $("#lstTourDuration").select2('data', {id: qStrDuration + "D", text: qStrDuration + " Days / " + (qStrDuration - 1) + " Nights"}); 142 } 143 144 filterFinal = filterType + filterValue1 + filterValue2; 145 146 if ($(filterFinal).length == 0) { 147 $(".packageAlert").text(primeDestProcess + " Tours not available from " + qStrFrom + " for selected duration. Find All " + primeDestProcess + " Tours starting from " + qStrFrom + "."); 148 filterFinal = filterType + filterValue1; 149 cityTours = $(filterFinal).length; 150 151 if (cityTours == 0) { 152 $(".packageAlert").text(primeDestProcess + " Tours not available from " + qStrFrom + " for selected duration. Please find tours starting from other cities."); 153 filterFinal = filterType + filterValue2; 154 $('#lstTourCity').val(null).trigger('change'); 155 156 if ($(filterFinal).length == 0) { 157 filterFinal = filterType; 158 $('#lstTourDuration').val(null).trigger('change'); 159 } 160 } else { 161 $('#lstTourDuration').val(null).trigger('change'); 162 } 163 } 164 165 $(filterFinal).removeClass ("hidden"); 166 $(".lazy").unveil(); 167 168 }; 169 170 //loadTourList(); 171 }); 172 173 app.directive('unveil', function () { 174 return { 175 link: function (scope, element, attrs) { 176 $(element).unveil(); 177 $("div.dest-popular-mn.add-margin > a > img, .tt_bottom img").removeAttr("style"); 178 179 } 180 }; 181 }); 182 183 app.directive('onFinishRender', ['$timeout', '$parse', function ($timeout, $parse) { 184 return { 185 restrict: 'A', 186 link: function (scope, element, attr) { 187 if (scope.$last === true) { 188 $timeout(function () { 189 scope.$emit('ngRepeatFinished'); 190 if (!!attr.onFinishRender) { 191 $parse(attr.onFinishRender)(scope); 192 } 193 }); 194 } 195 196 if (!!attr.onStartRender) { 197 if (scope.$first === true) { 198 $timeout(function () { 199 scope.$emit('ngRepeatStarted'); 200 if (!!attr.onStartRender) { 201 $parse(attr.onStartRender)(scope); 202 } 203 }); 204 } 205 } 206 } 207 } 208 }]); 209 210
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.