1formFactory.$inject = ['$http', '$rootScope']; 2 3angular.module('CA').factory('formFactory', formFactory); 4 5function formFactory($http, $rootScope) { 6 7 return { 8 9 saveSearch: function (payload) { 10 payload.append("ip", $rootScope.ip); 11 $http({ 12 url: 'api/Page/SaveSearch', 13 method: 'POST', 14 data: payload, 15 headers: {'Content-Type': undefined}, 16 transformRequest: angular.identity 17 }).then(function () { 18 }, function () { 19 }); 20 }, 21 22 saveMissingRoute: function (from, to, type) { 23 var fd = new FormData(); 24 fd.append('fingerprint', $rootScope.fingerprint); 25 fd.append("ip", $rootScope.ip); 26 fd.append('type', type); 27 fd.append('from', from); 28 fd.append('to', to); 29 $http({ 30 url: 'api/Page/SaveRouteSearch', 31 method: 'POST', 32 data: fd, 33 headers: {'Content-Type': undefined}, 34 transformRequest: angular.identity 35 }).then(function () { 36 37 }, function () { 38 }); 39 console.log(from + ' ' + to); 40 }, 41 42 getAll: function (callback) { 43 $http({ 44 url: 'api/Settings/GetSettings', 45 method: 'GET' 46 }).then(function (result) { 47 //alert("org"); 48 callback({Settings: result.Settings}); 49 }); 50 }, 51 52 getTopMenu: function (callback) { 53 $http({ 54 url: 'api/Page/GetTopMenu', 55 method: 'GET' 56 }).then(function (result) { 57 //alert("org"); 58 callback({TopMenu: result.TopMenu}); 59 }); 60 }, 61 62 63 getAllMenus: function (callback) { 64 $http({ 65 url: 'api/Page/GetMenuItems', 66 method: 'GET' 67 }).then(function (result) { 68 //alert("org"); 69 callback({Menus: result.Menus}); 70 }); 71 }, 72 73 getTopPromoSlider: function (callback) { 74 $http({ 75 url: 'api/PromoSlider/GetTopPromoSlider', 76 method: 'GET' 77 }).then(function (result) { 78 //alert("org"); 79 callback({PromoSlider: result.PromoSlider}); 80 }); 81 }, 82 83 getTopPromoFlights: function (callback) { 84 $http({ 85 url: 'api/promoflights/GetTopPromoFlights', 86 method: 'GET' 87 }).then(function (result) { 88 //alert("org"); 89 //alert(result.promo_flights.length); 90 //console.log(result.promo_flights); 91 callback({promo_flights: result.promo_flights}); 92 }); 93 }, 94 95 getSliderPromoSlider: function (callback) { 96 $http({ 97 url: 'api/PromoSlider/Getpromosliderswithfeatured', 98 method: 'GET' 99 }).then(function (result) { 100 //alert("org"); 101 callback({PromoSliders: result.PromoSliders}); 102 }); 103 }, 104 105 getcorporateitems: function (callback) { 106 $http({ 107 url: 'api/Page/Getcorporateitems', 108 method: 'GET' 109 }).then(function (result) { 110 //alert("org"); 111 //alert(result.promo_flights.length); 112 //console.log(result.promo_flights); 113 callback({corporateitems: result.corporateitems}); 114 }); 115 }, 116 117 getAllEssentials: function (callback) { 118 $http({ 119 url: 'api/essential/Getessentialslist', 120 method: 'GET' 121 }).then(function (result) { 122 //alert("org"); 123 callback({essentials: result.essentials}); 124 }); 125 }, 126 127 getIslandOftheMonth: function (callback) { 128 $http({ 129 url: 'api/Destination/GetIslandOftheMonth', 130 method: 'GET' 131 }).then(function (result) { 132 //alert("org"); 133 callback({islandofthemonth: result.islandofthemonth}); 134 }); 135 }, 136 137 getTopdestinations: function (callback) { 138 $http({ 139 url: 'api/Destination/GetTopdestinations', 140 method: 'GET' 141 }).then(function (result) { 142 //alert("org"); 143 callback({destinations: result.destinations}); 144 }); 145 }, 146 147 getroutes: function (callback) { 148 $http({ 149 url: 'api/Flight/Getroutesflights', 150 method: 'GET' 151 }).then(function (result) { 152 //alert("org"); 153 callback({routes: result.routes}); 154 }); 155 }, 156 157 getdestinations: function (id, callback, ecallback) {
158 ecallback = (typeof ecallback !== 'undefined') ? ecallback : function () { 159 }; 160 $http({ 161 url: 'api/Flight/Getdestinationsflights', 162 method: 'GET', 163 params: {id: id} 164 }).then(function (result) { 165 //alert("org"); 166 callback({destinations: result.destinations}); 167 }, function (err) { 168 ecallback(err); 169 }); 170 }, 171 172 getrouteflightbycodename: function (id, callback) { 173 $http({ 174 url: 'api/Flight/Getrouteflightbycodename', 175 method: 'GET', 176 params: {id: id} 177 }).then(function (result) { 178 //alert("org"); 179 callback({routes: result.routes}); 180 }); 181 }, 182 183 getTopdestination: function (callback) { 184 $http({ 185 url: 'api/Destination/GetTopdestination', 186 method: 'GET' 187 }).then(function (result) { 188 //alert("org"); 189 callback({destinations: result.destinations}); 190 }); 191 }, 192 193 getAllEvents: function (callback) { 194 $http({ 195 url: 'api/event/Getfronteventdetails', 196 method: 'GET' 197 }).then(function (result) { 198 //alert("org"); 199 callback({eventdetails: result.eventdetails}); 200 }); 201 }, 202 203 getAllQuickLinks: function (callback) { 204 $http({ 205 url: 'api/quicklink/Gettopquicklinks', 206 method: 'GET' 207 }).then(function (result) { 208 //alert("org"); 209 callback({quicklinks: result.quicklinks}); 210 }); 211 }, 212 213 getjoinuslink: function (callback) { 214 $http({ 215 url: 'api/Page/Getjoinuslink', 216 method: 'GET' 217 }).then(function (result) { 218 //alert("org"); 219 callback({pages: result.JoinUsLInk}); 220 }); 221 }, 222 223 getproduelink1: function (callback) { 224 $http({ 225 url: 'api/Page/Getproduelink1', 226 method: 'GET' 227 }).then(function (result) { 228 //alert("org"); 229 callback({plink1: result.plink1}); 230 }); 231 }, 232 233 getproduelink2: function (callback) { 234 $http({ 235 url: 'api/Page/Getproduelink2', 236 method: 'GET' 237 }).then(function (result) { 238 //alert("org"); 239 callback({plink2: result.plink2}); 240 }); 241 }, 242 243 checklogin: function (username, password, callback) { 244 $http({ 245 url: 'api/User/CheckMileNumber', 246 method: 'GET', 247 params: {username: username, password: password} 248 }).then(function (result) { 249 //alert("org"); 250 callback({userresponse: result.userresponse}); 251 }); 252 }, 253 254 getuserdetail: function (memberid, callback) { 255 $http({ 256 url: 'api/User/GetProfile', 257 method: 'GET', 258 params: {memberid: memberid + ""} 259 }).then(function (result) { 260 //alert("org"); 261 callback({userdetail: result.userdetail}); 262 }); 263 }, 264 265 getActivepressreleasetdetails: function (callback) { 266 $http({ 267 url: 'api/PressRelease/GetActivepressreleasetdetails', 268 method: 'GET' 269 }).then(function (result) { 270 //alert("org"); 271 callback({pressreleases: result.pressreleases}); 272 }); 273 }, 274 275 getActivepressreleasetdetail: function (id, callback) { 276 return $http({ 277 url: 'api/pressrelease/Getpressreleasedetail', 278 method: 'GET', 279 params: {id: id}, 280 }).then(function (result) { 281 callback(result); 282 }); 283 284 }, 285 286 getOtherpressreleasetdetails: function (callback) { 287 $http({ 288 url: 'api/PressRelease/GetOtherpressreleasetdetails', 289 method: 'GET' 290 }).then(function (result) { 291 //alert("org"); 292 callback({otherpressreleases: result.pressreleases}); 293 }); 294 }, 295 296 getactivetravelalerttdetails: function (callback) { 297 $http({ 298 url: 'api/TravelAlert/Getactivetravelalerttdetails', 299 method: 'GET' 300 }).then(function (result) { 301 //alert("org"); 302 callback({travelalerts: result.travelalerts}); 303 }); 304 }, 305
306 gettravelalertdetail: function (id, callback) { 307 return $http({ 308 url: 'api/TravelAlert/Gettravelalertdetail', 309 method: 'GET', 310 params: {id: id}, 311 }).then(function (result) { 312 callback(result); 313 }); 314 315 }, 316 317 getTopTravelAlert: function (callback) { 318 $http({ 319 url: 'api/TravelAlert/GetLatesttravelalertdetail', 320 method: 'GET' 321 }).then(function (result) { 322 //alert("org"); 323 if (result.travelalertdetail != null) { 324 callback({travelalertdetail: result.travelalertdetail}); 325 } 326 else { 327 callback({pressreleasdetail: result.pressreleas}); 328 } 329 }); 330 }, 331 332 savesurvey: function (survey) { 333 // console.log(section); 334 return $http({ 335 url: 'api/Common/SaveSurvey', 336 method: 'POST', 337 headers: {'Content-Type': undefined}, 338 data: { 339 comments: survey.comments, 340 surveydesc: survey.surveydesc, 341 rate: survey.rate 342 }, 343 transformRequest: function (data, headersGetter) { 344 var formData = new FormData(); 345 angular.forEach(data, function (value, key) { 346 formData.append(key, value); 347 }); 348 349 350 return formData; 351 } 352 }).then(function (result) { 353 callback(result); 354 }); 355 }, 356 357 getStateProviders: function (callback) { 358 $http({ 359 url: 'api/Common/GetStateProviders', 360 method: 'GET' 361 }).then(function (result) { 362 //alert("org"); 363 callback({stateproviders: result.stateproviders}); 364 }); 365 }, 366 367 getRoutesFlights: function (successCB, errorCB) { 368 $http({ 369 url: 'api/Flight/Getroutesflights', 370 method: 'GET' 371 }).then(function (result) { 372 successCB({routes: result.data.routes}); 373 }, 374 function (err) { 375 errorCB(); 376 }); 377 }, 378 379 getRoutesFlightsMC: function (successCB, errorCB) { 380 $http({ 381 url: 'api/Flight/GetroutesflightsMc', 382 method: 'GET' 383 }).then(function (result) { 384 successCB({routes: result.data.routes}); 385 }, 386 function (err) { 387 errorCB(); 388 }); 389 }, 390 getBookingURL: function (postData, successCB, errorCB) { 391 $http({ 392 url: 'api/Booking/GetBookingParams', 393 method: 'POST', 394 data: postData, 395 headers: {'Content-Type': undefined}, 396 //prevents serializing payload. don't do it. 397 transformRequest: angular.identity 398 }).then(function (result) { 399 successCB({res: result}); 400 }, function (e) { 401 errorCB(e); 402 }); 403 }, 404 getManageBookingURL: function (postData, successCB, errorCB) { 405 $http({ 406 url: 'api/Booking/ManageBooking', 407 method: 'POST', 408 data: postData, 409 headers: {'Content-Type': undefined}, 410 //prevents serializing payload. don't do it. 411 transformRequest: angular.identity 412 }).then(function (result) { 413 successCB({res: result}); 414 }, function (e) { 415 errorCB(e); 416 }); 417 }, 418 getCheckInURL: function (postData, successCB, errorCB) { 419 $http({ 420 url: 'api/Booking/CheckIn', 421 method: 'POST', 422 data: postData, 423 headers: {'Content-Type': undefined}, 424 //prevents serializing payload. don't do it. 425 transformRequest: angular.identity 426 }).then(function (result) { 427 successCB({res: result}); 428 }, function (e) { 429 errorCB(e); 430 }); 431 }, 432 getUpgradeURL: function (postData, successCB, errorCB) { 433 $http({ 434 url: 'api/Booking/Upgrade', 435 method: 'POST', 436 data: postData, 437 headers: {'Content-Type': undefined}, 438 //prevents serializing payload. don't do it. 439 transformRequest: angular.identity 440 }).then(function (result) { 441 successCB({res: result}); 442 }, function (e) { 443 errorCB(e); 444 }); 445 }, 446 getFlightStatus: function (postData, successCB, errorCB) { 447 $http({ 448 url: '/get/Flight/Status', 449 method: 'POST', 450 data: postData, 451 headers: {'Content-Type': 'application/json'} 452 }).then(function (result) { 453 successCB({res: result}); 454 }, function (e) { 455 errorCB(e); 456 }); 457 }, 458 getCarsSuggestion: function (kw, canceller, successCB, errorCB) { 459 var fd = new FormData(); 460 fd.append('kw', kw); 461 462 $http({ 463 url: 'api/Cars/Suggest', 464 method: 'POST', 465 data: fd, 466 headers: {'Content-Type': undefined}, 467 //prevents serializing payload. don't do it. 468 transformRequest: angular.identity, 469 timeout: canceller.promise 470 }).then(function (result) { 471 successCB({res: result}); 472 }, function (e) { 473 errorCB(e); 474 }); 475 }, 476 getCarsIPData: function (successCB, errorCB) { 477 $http.get('api/Cars/LocationData').then(function (result) { 478 successCB({res: result}); 479 }, function (e) { 480 errorCB(e); 481 }); 482 }, 483 loginMiles: function (user, pass, successCB, errorCB) { 484 var fd = new FormData(); 485 fd.append('username', user); 486 fd.append('password', btoa(pass)); 487 $http({ 488 url: 'api/Miles/Login', 489 method: 'POST', 490 data: fd, 491 headers: {'Content-Type': undefined}, 492 //prevents serializing payload. don't do it. 493 transformRequest: angular.identity 494 }).then(function (result) { 495 successCB({res: result}); 496 }, function (e) { 497 errorCB(e); 498 }); 499 }, 500 logoutMiles: function (successCB, errorCB) { 501 $http({ 502 url: 'api/Miles/Logout', 503 method: 'GET' 504 }).then(function (result) { 505 successCB({res: result.data.status}); 506 }, 507 function (err) { 508 errorCB(err); 509 }); 510 }, 511 sessionMiles: function (successCB, errorCB) { 512 $http({ 513 url: 'api/Miles/CheckSession', 514 method: 'GET' 515 }).then(function (result) { 516 successCB({res: result.data}); 517 }, 518 function (err) { 519 errorCB(); 520 }); 521 }, 522 523 submitFeedback: function( feedback_data, successCB, errorCB){ 524 $http({ 525 url: 'api/submit/feedback', 526 method: 'POST', 527 data: feedback_data, 528 headers: {'Content-Type': 'application/json'} 529 }).then(function(result){ 530 successCB({res: result.data}); 531 },function(){ 532 errorCB(); 533 }); 534 } 535 536 }; 537}
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.