PageSourceSearch

https://my.cazloyd.com/js/itinerary.js

js cazloyd.com collected 2026-10-01 14:47:57 UTC 68,187 bytes, 1,853 lines download raw bytes

1var isgItinerary = new function () {
2  var me = this;
3
4  this.ReplacedViewContent = function (view, itineraryNo, isGroup, ActualViewName) {
5    try {
6      if (itineraryNo == "") {
7        itineraryNo = $('#ItineraryNo').val();
8      }
9      $("#" + view + "Tab").removeClass('selected');
10      $($('#' + view + "Tab").parent()).removeClass("mm-listitem_selected");
11      if (view == "Itinerary") {
12        $('.img_slider').addClass('main_itinerary');
13        //$('.Itineraryheadsntnc').show();
14      }
15      else {
16        $('.img_slider').removeClass('main_itinerary');
17        //$('.Itineraryheadsntnc').hide();
18      }
19      var ViewURL = hostURL + "Itinerary/" + view + "ViewContent";
20      var dataParam = { ItineraryNo: itineraryNo, publishVersion: parseInt($("#PublishVersion").val()) || 0 };
21      if (!myAccountCommon.isNullOrEmpty(isGroup) && isGroup.toString().toLowerCase() == 'true' && view == 'Itinerary') {
22        var genericTourCode = $('#dhruv_analytics_generictourcode').val();
23        var depDate = $('#dhruv_analytics_depDate').val();
24        ViewURL = hostURL + "Common/ConvertAPItoPDF";
25        dataParam = { Id: genericTourCode + "|" + depDate }; //? countrycode = en_gb 
26      }
27
28      if (typeof Offline != "undefined" && Offline.state == "up") {
29        $.ajax({
30          cache: false,
31          async: true,
32          url: ViewURL,
33          data: dataParam,
34          beforeSend: function () {
35            $('.viewall_btnblk').show();
36            $("#ItinImageReplacedContent").show();
37            $("#ReplacedContent").html('');
38          },
39          success: function (resultJson) {
40            $('.viewall_btnblk').hide();
41            $("#ItinImageReplacedContent").hide();
42            $('#ReplacedContent').html('');
43            $('#ReplacedContent').show();
44            $('#ReplacedContent').html(resultJson);
45            $('.no_padding_all.hdsgnpg_rightpnl').removeClass('blk_visible');
46            $('.hamburger-mobi-menu').removeClass('open');
47            $('.icon-btn').removeClass('show')
48            $('html,body').animate({ scrollTop: $("#ReplacedContent").offset().top - 150 }, 'slow');
49            $('.hdsgnpg_rtnvlst').find('li').each(function () {
50              $(this).removeClass('cur');
51            });
52            $('.trip__menu').find('li').each(function () {
53              $(this).find("a").removeClass('selected');
54            })
55            //$('#ddlListTab .filter-option').text(me.ActualViewName(view));
56            $('#ddlListTab .filter-option').val(me.ActualViewName(view));
57            if (ActualViewName != undefined) {
58              $('#ddlListTab .filter-option').text(ActualViewName);
59            }
60            $("#" + view + "Tab").parent().addClass('cur');
61            $('.hdsgnpg_rtnvblk').find('li').each(function () {
62              $(this).find("a").removeClass('selected');
63            });
64
65            $("#" + view + "Tab").addClass('selected');
66            $($(".fixed_sidebar").find("#" + view + "Tab")).addClass("selected");
67
68            $('#ddlListTab').find('option').each(function () {
69              $(this).removeClass('selected');
70            });
71            $("#ddl" + view).addClass('selected');
72            myAccountCommon.ToggleItinDetils();
73
74            var mmMenu = $("#Tripmenu").data("mmenu");
75            if (mmMenu) {
76              mmMenu.close();
77            }
78          },
79          error: function (msg) {
80            $('#ReplacedContent').html('<center><p>' + MyAccountConstants.GenericErrorMsg + '</p></center>');
81            $("#ItinImageReplacedContent").hide();
82            $('.viewall_btnblk').hide();
83          }
84        });
85      }
86      else {
87        var db = new PouchDB('myAppDb');
88        var ItineraryDetail = null;
89        var itineraryNoVersion = itineraryNo + "_" + $("#PublishVersion").val();
90        db.get(itineraryNoVersion).then(function (doc) {
91          ItineraryDetail = doc;
92          $('.viewall_btnblk').show();
93          $("#ItinImageReplacedContent").show();
94          $("#ReplacedContent").html('');
95
96          $('.viewall_btnblk').hide();
97          $("#ItinImageReplacedContent").hide();
98          $('#ReplacedContent').html('');
99          $('#ReplacedContent').show();
100          switch (view) {
101            case "Itinerary":
102              $('#ReplacedContent').html(ItineraryDetail.Itinerary);
103              break;
104            case "Accommodation":
105              $('#ReplacedContent').html(ItineraryDetail.Accommodation);
106              break;
107            case "Notes":
108              $('#ReplacedContent').html(ItineraryDetail.Notes);
109              break;
110            case "Cost":
111              $('#ReplacedContent').html(ItineraryDetail.Cost);
112              break;
113            case "CoverLetter":
114              $('#ReplacedContent').html(ItineraryDetail.CoverLetter);
115              break;
116            case "Flight":
117              $('#ReplacedContent').html(ItineraryDetail.Flight);
118              break;
119            case "Specialists":
120              $('#ReplacedContent').html(ItineraryDetail.Specialists);
121              break;
122            case "TourLeader":
123              $('#ReplacedContent').html(ItineraryDetail.TourLeader);
124              break;
125            case "QuickItinerary":
126              $('#ReplacedContent').html(ItineraryDetail.QuickItinerary);
127              break;
128            case "TourHighLights":
129              $('#ReplacedContent').html(ItineraryDetail.TourHighLights);
130              break;
131          }
132
133          $('.hdsgnpg_rtnvlst').find('li').each(function () {
134            $(this).removeClass('cur');
135          });
136          $("#" + view + "Tab").parent().addClass('cur');
137
138          $('#ddlListTab').find('option').each(function () {
139            $(this).removeClass('selected');
140          });
141          $("#ddl" + view).addClass('selected');
142          myAccountCommon.ToggleItinDetils();
143        }).catch(function (err) {
144        });
145      }
146    }
147    catch (ex) {
148      $("#ItinImageReplacedContent").hide();
149      $('.viewall_btnblk').hide();
150    }
151  }
152
153  this.ActualViewName = function (view) {
154    switch (view) {
155      case "Itinerary":
156        return "Itinerary";
157        break;
158      case "Accommodation":
159        return "Accommodation"
160        break;
161      case "Notes":
162        return "Notes"
163        break;
164      case "ItineraryAtAGlance":
165        return "Itinerary in brief"
166        break;
167      case "Cost":
168        return "Cost"
169        break;
170      case "CoverLetter":
171        return "Cover Letter";
172        break;
173      case "Flight":
174        return "Flight";
175        break;
176      case "Specialists":
177        return "Specialists";
178        break;
179      case "TourLeader":
180        return "Tour Leader";
181        break;
182      case "QuickItinerary":
183        return "QuickItinerary";
184        break;
185      case "TourHighLights":
186        return "TourHighLights";
187        break;
188      case "JoiningInfo":
189        return "Joining Information";
190        break;
191      case "Extension":
192        return "Extension";
193        break;
194      case "Map":
195        return "Map";
196        break;
197      default:
198        return view;
199    }
200  }
201
202  this.ReplacedViewContentOnMenuSelect = function (view, itineraryNo, callBackFunc) {
203    try {
204      var val = ($("#hdnShowOneStopDestinationsInd").val() || "").toString().toLowerCase();
205      if (view == "Overview" || view == "HIOverview" || val == "true") {
206        $(".common_header_blk").hide();  //itin intro on other pages
207        $("#OverViewHeader").html('').hide();   //intor on banner on overview page
208        $("#ItineraryHeader").html('').hide();
209        $(".divider_line").hide();
210        $("#ReplacedContent").addClass('overview_loader');
211      }
212      else {
213        $(".common_header_blk").show();
214        $("#OverViewHeader").hide();
215        $("#ItineraryHeader").hide();//intor on banner on overview page
216        $(".divider_line").show();
217        $("#ReplacedContent").removeClass('overview_loader');
218      }
219
220      var mmMenu = $("#tripMenu").data("mmenu");
221      if (mmMenu) {
222        mmMenu.close();
223      }
224      var menuNameforSmallScreen;
225      switch (view) {
226        case "Cost":
227          menuNameforSmallScreen = "Pricing";
228          break;
229        case "Overview":
230          menuNameforSmallScreen = "Overview";
231          break;
232        case "Fullitinerary":
233          menuNameforSmallScreen = "Full Itinerary";
234          break;
235        case "Accommodations":
236          menuNameforSmallScreen = "Accommodation";
237          break;
238        case "Map":
239          menuNameforSmallScreen = "Map";
240          break;
241        case "Flights":
242          menuNameforSmallScreen = "Flights";
243          break;
244        case "Information":
245          menuNameforSmallScreen = "Important Information";
246          break;
247        case "HIFullitinerary":
248          menuNameforSmallScreen = "HIFullitinerary";
249          break;
250        case "HIOverview":
251          menuNameforSmallScreen = "HIOverview";
252          break;
253        case "HIAccommodations":
254          menuNameforSmallScreen = "HIAccommodations";
255          break;
256        case "HIFlight":
257          menuNameforSmallScreen = "HIFlight";
258          break;
259        case "HIMap":
260          menuNameforSmallScreen = "HIMap";
261          break;
262
263        
264      }
265
266      $(".page_title").text(menuNameforSmallScreen)
267
268      var ajaxData = view == "Itinerary" ? { id: itineraryNo } : { ItineraryNo: itineraryNo };
269
270      $(".myacc_linklst_04").find("li").each(function () {
271        $(this).removeClass("cur");
272      });
273      $("." + view).addClass("cur");
274
275      if (view != "Itinerary") {
276        $.ajax({
277          cache: false,
278          async: true,
279          url: hostURL + "Itinerary/" + view + "Detail",
280          data: {  //     ajaxData,
281            ItineraryNo: itineraryNo
282          },
283          beforeSend: function () {
284
285            $("#ReplacedContent").html('');
286            $('#ReplacedContent').html('<div class="loader_icon" style="background-image: url(' + hostURL + 'Content/BR/Images/UK/loader.svg); width: 100%; height: 200px; background-repeat: no-repeat; background-position: center;"></div>');
287            $('html,body').animate({ scrollTop: $("#ReplacedContent").offset().top - 150 }, 'slow');
288          },
289          success: function (resultJson) {
290            //var mmMenu = $("#tripMenu").data("mmenu");
291            //if (mmMenu) {
292            //  mmMenu.close();
293            //}
294            //if ($("#tripMenu.mm-menu_opened").length > 0)
295            //{
296            //  $(".menuIcon").addClass("menu_opened");
297            //}
298            //else
299            //{
300            //  $(".menuIcon").addClass("menu_closed");
301            //}
302            // $('.itin_hdr_panel').find(".menuIcon").toggleClass("menu_opened menu_closed");
303            $('.itin_hdr_panel').find(".menuIcon").removeClass("menu_opened");
304            $('.itin_hdr_panel').find(".menuIcon").addClass("menu_closed");
305            $('.viewall_btnblk').hide();
306            $("#ItinImageReplacedContent").hide();
307            $("#ReplacedContent").removeClass('overview_loader');
308            $('#ReplacedContent').show();
309            $('#ReplacedContent').html(resultJson);
310            $('html,body').animate({ scrollTop: $("#ReplacedContent").offset().top - 150 }, 'slow');
311            $('.hdsgnpg_rtnvlst').find('li').each(function () {
312              $(this).removeClass('cur');
313            });
314
315            if (callBackFunc) {
316              callBackFunc();
317            }
318          },
319          error: function (msg) {
320            $('#ReplacedContent').html('<center><p>' + MyAccountConstants.GenericErrorMsg + '</p></center>');
321            $("#ItinImageReplacedContent").hide();
322            $('.viewall_btnblk').hide();
323          }
324        });
325      }
326      else {
327        location.reload(true);
328      }
329    }
330    catch (ex) {
331      $("#ItinImageReplacedContent").hide();
332      $('.viewall_btnblk').hide();
333    }
334  }
335
336  this.ChangeImpInfoMenu = function (view, itineraryNo, callbackFunc) {
337    $(".impmenu").each(function () {
338      $(this).removeClass("active")
339    });
340
341    $("." + view).addClass("active");
342    $.ajax({
343      cache: false,
344      async: true,
345      url: hostURL + "Itinerary/InformationDetail",
346      data: { ItineraryNo: itineraryNo, tabname: view },
347      beforeSend: function () {
348        $('#ReplacedImpInfo').html('<div style="background-image: url(' + hostURL + 'Content/BR/Images/UK/loader.svg); width: 100%; height: 200px; background-repeat: no-repeat; background-position: center;"></div>');
349      },
350      success: function (resultJson) {
351        $("#ItinImageReplacedContent").hide();
352        $('#ReplacedImpInfo').html('');
353        $('#ReplacedImpInfo').show();
354        $('#ReplacedImpInfo').html(resultJson);
355        $('html,body').animate({ scrollTop: $("#ReplacedImpInfo").offset().top - 150 }, 'slow');
356        if (callbackFunc) {
357          callbackFunc();
358        }
359      },
360      error: function (msg) {
361        $('#ReplacedImpInfo').html('<center><p>' + MyAccountConstants.GenericErrorMsg + '</p></center>');
362      }
363    });
364  }
365
366  this.ReplacedViewContentForMobile = function (view, itineraryNo) {
367    try {
368      if (view == "Itinerary") {
369        $('.img_slider').addClass('main_itinerary');
370      }
371      else {
372        $('.img_slider').removeClass('main_itinerary');
373      }
374      if (typeof Offline != "undefined" && Offline.state == "up") {
375        $.ajax({
376          cache: false,
377          async: true,
378          url: hostURL + "Itinerary/" + view + "ViewContent",
379          data: { ItineraryNo: itineraryNo },
380          beforeSend: function () {
381            $('.viewall_btnblk').show();
382            $("#ItinImageReplacedContent").show();
383            $("#ReplacedContent").html('');
384          },
385          success: function (resultJson) {
386            $('.viewall_btnblk').hide();
387            $("#ItinImageReplacedContent").hide();
388            $('#ReplacedContent').html('');
389            $('#ReplacedContent').show();
390            $('#ReplacedContent').html(resultJson);
391
392            $('.hdsgnpg_rtnvlst').find('li').each(function () {
393              $(this).removeClass('cur');
394            });
395            $("#" + view + "Tab").parent().addClass('cur');
396
397            $('#ddlListTab').find('option').each(function () {
398              $(this).removeClass('selected');
399            });
400            $("#ddl" + view).addClass('selected');
401            myAccountCommon.ToggleItinDetils();
402            var mmMenu = $("#Tripmenu").data("mmenu");
403            if (mmMenu) {
404              mmMenu.close();
405            }
406          },
407          error: function (msg) {
408            $('#ReplacedContent').html('<center><p>' + MyAccountConstants.GenericErrorMsg + '</p></center>');
409            $("#ItinImageReplacedContent").hide();
410            $('.viewall_btnblk').hide();
411          }
412        });
413      }
414      else {
415        var db = new PouchDB('myAppDb');
416        var ItineraryDetail = null;
417        var itineraryNoVersion = itineraryNo + "_" + $("#PublishVersion").val();
418        db.get(itineraryNoVersion).then(function (doc) {
419          ItineraryDetail = doc;
420          $('.viewall_btnblk').show();
421          $("#ItinImageReplacedContent").show();
422          $("#ReplacedContent").html('');
423
424          $('.viewall_btnblk').hide();
425          $("#ItinImageReplacedContent").hide();
426          $('#ReplacedContent').html('');
427          $('#ReplacedContent').show();
428          switch (view) {
429            case "Itinerary":
430              $('#ReplacedContent').html(ItineraryDetail.Itinerary);
431              break;
432            case "Accommodation":
433              $('#ReplacedContent').html(ItineraryDetail.Accommodation);
434              break;
435            case "Notes":
436              $('#ReplacedContent').html(ItineraryDetail.Notes);
437              break;
438            case "Cost":
439              $('#ReplacedContent').html(ItineraryDetail.Cost);
440              break;
441            case "CoverLetter":
442              $('#ReplacedContent').html(ItineraryDetail.CoverLetter);
443              break;
444            case "Flight":
445              $('#ReplacedContent').html(ItineraryDetail.Flight);
446              break;
447            case "Specialists":
448              $('#ReplacedContent').html(ItineraryDetail.Specialists);
449              break;
450            case "TourLeader":
451              $('#ReplacedContent').html(ItineraryDetail.TourLeader);
452              break;
453            case "QuickItinerary":
454              $('#ReplacedContent').html(ItineraryDetail.QuickItinerary);
455              break;
456            case "TourHighLights":
457              $('#ReplacedContent').html(ItineraryDetail.TourHighLights);
458              break;
459          }
460
461          $('.hdsgnpg_rtnvlst').find('li').each(function () {
462            $(this).removeClass('cur');
463          });
464          $("#" + view + "Tab").parent().addClass('cur');
465
466          $('#ddlListTab').find('option').each(function () {
467            $(this).removeClass('selected');
468          });
469          $("#ddl" + view).addClass('selected');
470          myAccountCommon.ToggleItinDetils();
471        }).catch(function (err) {
472        });
473      }
474    }
475    catch (ex) {
476      $("#ItinImageReplacedContent").hide();
477      $('.viewall_btnblk').hide();
478    }
479  }
480
481  this.ShowPredepartureInfo = function (id) {
482    var selectedTab = $('#ddlListCoun option:selected').val();
483    $(".InfoByCount").hide() //hide all div
484    $("#" + selectedTab + ".InfoByCount").show();
485    $(".tab_nav_title").hide();
486  }
487
488  this.ViewChangeOnDropdown = function () {
489    var selectedOption = $('#ddlListTab option:selected');
490    //var selectedTextTab = $('#ddlListTab option:selected').text();
491    var selectedTab = selectedOption.val();                
492    var isDocument = selectedOption.data('type');         
493
494    var ItineraryNo = $("#ItineraryNo").val();
495    var DecryptedItinNo = $("#DecryptedItinNo").val();
496    var whySteppesLink = $("#whySteppesLink").val();
497    var travelAppLink = $("#travelAppLink").val();
498    var visaData = $("#visaData").val();
499    var OnlinePaymentLink = $("#OnlinePaymentLink").val();
500    var PTQLink = $("#PTQLink").val();
501    var atolDownloadLink = $("#atolDownloadLink").val();
502    var invoiceDownloadLink = $("#invoiceDownloadLink").val();
503    var Documents = $("#ddlDocuments").attr('name');
504    var OBFLink = $("#OBFLink").val();
505
506    if (isDocument === "document") {
507      var downloadUrl = selectedTab; 
508      var docId = selectedOption.data('id');
509      console.log("Downloading:", downloadUrl);
510
511      isgItinerary.DownloadLink(downloadUrl, docId);
512      return; 
513    }
514
515
516    if (selectedTab == "CoverLetter" || selectedTab == "Introduction")
517      isgItinerary.ReplacedViewContent('CoverLetter', ItineraryNo)
518    else if (selectedTab == "Specialists")
519      isgItinerary.ReplacedViewContent('Specialists', ItineraryNo)
520    //else if (selectedTab == "Cost")
521    //  isgItinerary.ReplacedViewContent('Cost', ItineraryNo)
522    else if (selectedTab == "Cost")
523      isgItinerary.ReplacedViewContent('Cost', ItineraryNo)
524    else if (selectedTab == "Flight")
525      isgItinerary.ReplacedViewContent('Flight', ItineraryNo)
526    else if (selectedTab == "Accommodation")
527      isgItinerary.ReplacedViewContent('Accommodation', ItineraryNo)
528    else if (selectedTab == "TourLeader")
529      isgItinerary.ReplacedViewContent('TourLeader', ItineraryNo)
530    else if (selectedTab == "Notes")
531      isgItinerary.ReplacedViewContent('Notes', ItineraryNo)
532    else if (selectedTab == "Map")
533      isgItinerary.ReplacedViewContent('Map', ItineraryNo)
534    else if (selectedTab == "TourHighLights")
535      isgItinerary.ReplacedViewContent('TourHighLights', ItineraryNo)
536    else if (selectedTab == "Itinerary")
537      isgItinerary.ReplacedViewContent('Itinerary', ItineraryNo)
538    else if (selectedTab == "Document")
539      isgItinerary.ReplacedViewContent('Document', ItineraryNo)
540
541    else if (selectedTab == "WhySteppes") {
542      window.location.href = whySteppesLink;
543    }
544    else if (selectedTab == "VISAInformation") {
545      window.location.href = visaData;
546    }
547    else if (selectedTab == "TravelAppLink") {
548      window.location.href = travelAppLink;
549    }
550    else if (selectedTab == "OnlinePayment") {
551      window.location.href = OnlinePaymentLink;
552    }
553    else if (selectedTab == "BookingForm") {
554      window.location.href = OBFLink;
555    }
556    else if (selectedTab == "Invoice") {
557      isgItinerary.DownloadLink(invoiceDownloadLink, 'invoice')
558    }
559    else if (selectedTab == "ATOLCertificate") {
560      isgItinerary.DownloadLink(atolDownloadLink, 'atol')
561    }
562    else if (selectedTab == "PostTravelQuestionnaire") {
563      window.location.href = PTQLink;
564    }
565    else if (selectedTab == "DownloadAndPrintItin") {
566      isgItinerary.SavePageBreakXmlAndDwnldItinInMobileView(DecryptedItinNo, false, '', '', '', '', '', true)
567    }
568    else if (Documents == "Documents") {
569      window.location.href = selectedTab;
570    }
571    else
572      isgItinerary.ReplacedViewContent(selectedTab, ItineraryNo)
573  }
574
575  this.RedirectToAccommodation = function (itineraryNo, hotelCode) {
576    isgItinerary.ReplacedViewContentOnMenuSelect('Accommodations', itineraryNo, RedirectToAccommodationFunc);
577    function RedirectToAccommodationFunc() {
578      setTimeout(function () {
579        $('html,body').animate({ scrollTop: $("#accomTab_" + hotelCode).offset().top - 125 }, 'slow');
580      }, 1000);
581    }
582  }
583
584  this.QuotePopup = function (itineraryDetails) {
585    var preparedOn = '';
586    var preparedFor = '';
587    if (itineraryDetails != undefined) {
588      preparedOn = myAccountCommon.ParseJsonDateToDateTime(JSON.parse(itineraryDetails).PreparedOn);
589      preparedFor = JSON.parse(itineraryDetails).PreparedFor;
590      $.ajax({
591        cache: false,
592        async: false,
593        url: hostURL + "Quotes/GetDayWiseItinerary",
594        data: { itineraryNo: JSON.parse(itineraryDetails).ItineraryNumber },
595        beforeSend: function () {
596          $("#quoteModal").html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>');
597        },
598        success: function (resultJson) {
599          $('#quoteModal').html('');
600          $('#quoteModal').html(resultJson);
601          if (preparedOn != null && preparedOn != '') {
602            $('#quoteModal .quote_infotxt1').html('prepared on ' + myAccountCommon.AppendZero(preparedOn.getDate()) + "." + myAccountCommon.AppendZero((preparedOn.getMonth() + 1)) + "." + preparedOn.getFullYear());
603          }
604          else {
605            $('#quoteModal .quote_infotxt1').html('');
606          }
607          if (preparedFor != null && preparedFor != '') {
608            $('#quoteModal .quote_infotxt2').html('For: ' + preparedFor);
609          } else {
610            $('#quoteModal .quote_infotxt2').html('');
611          }
612        },
613        error: function (msg) {
614          $("#quoteModal").html(MyAccountConstants.GenericErrorMsg);
615        }
616      });
617    }
618    else {
619      $("#quoteModal").html(MyAccountConstants.NoDetailsFound);
620    }
621  }
622
623  this.UploadDoc = function (/*ItineraryNo, ItineraryNo*/) {
624    $("#btnupload").attr("disabled", true);
625    $("#uploadLoader").html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>').show();
626    //$("#uploadForm").submit();
627    //if (ItineraryNo != undefined || BookingNo != undefined) {
628
629    //  var fileInput = document.getElementById('myfile');
630    //  //var file = fileInput.files;
631    //  $.ajax({
632    //    cache: false,
633    //    async: false,
634    //    type: "post",
635    //    url: hostURL + "Common/SaveDocument",
636    //    data: {
637    //      itinearyNo: ItineraryNo,
638    //      BkgNo: BookingNo,
639    //      docType: $("#doctype").val(),
640    //      docSubType: $("#docsubtype").val(),
641    //      notes: $("#txtNotes").val(),
642    //      docOrgPath: $("#myfile").val(),
643    //      docName: fileInput.files[0].name
644    //    },
645    //    beforeSend: function () {
646    //      $("#uploadLoader").html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>').show();
647    //    },
648    //    success: function (resultJson) {
649    //      $('#uploadLoader').html('');
650    //      $('#uploadLoader').html("Uploaded Document successfully").show();
651    //    },
652    //    error: function (msg) {
653    //      $("#uploadLoader").html(MyAccountConstants.GenericErrorMsg);
654    //    }
655    //  });
656    //}
657    //else {
658    //  $("#uploadLoader").html(MyAccountConstants.NoDetailsFound);
659    //}
660  }
661
662  this.UploadDocument = function () {
663    var fileupload = $('#fileupload')[0].files[0];
664    var fileuploadName = $('#fileupload')[0].files[0].name;
665    var formData = new FormData();
666    formData.append('file', $('#fileupload')[0].files[0]);
667
668    var input = document.getElementById('fileupload');
669    console.log(input.files);
670    $.ajax({
671      cache: false,
672      async: false,
673      type: "post",
674      url: hostURL + "Common/UploadDocument",
675      data: {
676        file: fileuploadName
677      },
678      beforeSend: function () {
679        $("#uploadLoader").html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>').show();
680      },
681      success: function (resultJson) {
682        $('#uploadLoader').html('');
683        $('#uploadLoader').html("Uploaded Document successfully").show();
684      },
685      error: function (msg) {
686        $("#uploadLoader").html(MyAccountConstants.GenericErrorMsg);
687      }
688    });
689  }
690
691  this.UploadDocumentValidation = function (event) {
692    if ($("#hdndocumentType").val() == undefined || myAccountCommon.isNullOrEmpty($("#hdndocumentType").val())) {
693      $("#validatemsg").show();
694      $("#validatemsg").html("Please select document type");
695      event.preventDefault();
696      return false;
697    }
698
699    if ($("#hdnnotes").val() == undefined || myAccountCommon.isNullOrEmpty($("#hdnnotes").val())) {
700      $("#validatemsg").show();
701      $("#validatemsg").html("Please enter notes");
702      event.preventDefault();
703      return false;
704    }
705    return true;
706  }
707
708  this.DownloadLink = function (link, id) {
709    var iframeID = id + "downloadFrame";
710    var loadHtml = hostURL + 'images/ajax-loader.gif';
711    $('#' + iframeID).show();
712    $('#' + iframeID).height('0');
713    $('#' + iframeID).css('opacity', '0')
714    //$('#' + iframeID).attr('src', loadHtml);
715    $('#' + iframeID).attr('src', link);
716    //$('#' + iframeID).hide();
717    setTimeout(function () {
718      //var htmlContent = $('#' + iframeID).contents().find('html');
719      //$('#' + iframeID).contents().find('html').val()
720      $('#' + iframeID).hide();
721      $('#' + iframeID).attr('src', '');
722    }, 2000);
723    //$('#' + iframeID).on("load", function () {
724    //  alert('load over');
725    //});
726  }
727
728  this.OpenContactTravelExpert = function (travelID) {
729    var itineraryName = $('#ItinearyName p').html();
730    $.ajax({
731      cache: false,
732      async: false,
733      url: hostURL + "Common/OpenContactTravelExpert",
734      data: {
735        itineraryName: itineraryName,
736        travelID: travelID
737      },
738      beforeSend: function () {
739        $("#ContactTravelExpert").html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>');
740      },
741      success: function (resultJson) {
742        $('#ContactTravelExpert').html('');
743        $('#ContactTravelExpert').html(resultJson);
744      },
745      error: function (msg) {
746        $("#ContactTravelExpert").html(MyAccountConstants.GenericErrorMsg);
747      }
748    });
749  }
750
751  this.SendEmailToTravelExpert = function () {
752    if (CheckValidEmail() && CheckTravelexpertSubject() && CheckTravelExpertContent()) {
753      $("#ContactExpertPreloader").show();
754      try {
755        $.ajax({
756          cache: false,
757          type: "post",
758          url: hostURL + "Common/SendEmailTravelExpert",
759          data: {
760            emailSubject: $('#SubjectName').val(),
761            emailTo: $('#ClientEmailaddress').html(),
762            emailContent: $('#EmailMailContent').val(),
763            sendCopy: $('#chkCopyEmailToMe').prop("checked")
764          },
765          success: function (result) {
766            $("#ContactExpertPreloader").hide();
767            if (result.Status) {
768              $("#msgDisplaySendMailSuccess").text(MyAccountConstants.ContactTravelExpertSuccessMsg);
769              $("#msgDisplaySendMailSuccess").show();
770              setTimeout(function () {
771                $("#msgDisplaySendMailSuccess").hide(); $("#msgDisplaySendMailSuccess").text('');
772              }, 3000);
773            }
774            else {
775              $("#msgDisplaySendMailError").text(MyAccountConstants.ContactTravelExpertErrorMsg);
776              $("#msgDisplaySendMailError").show();
777              setTimeout(function () {
778                $("#msgDisplaySendMailError").hide();
779              }, 3000);
780            }
781          },
782          error: function (msg) {
783            if (!myAccountCommon.isNullOrEmpty($.trim(msg.responseText))) {
784              if (msg.responseText.match('Error has occured') != null && msg.responseText.match('Error has occured').length > 0) {
785                myAccountCommon.RedirectToUrl('', 'Account/Error');
786              }
787              else {
788                $("#ContactExpertPreloader").hide();
789                console.log(msg);
790                $("#msgDisplaySendMailError").text(MyAccountConstants.ContactTravelExpertErrorMsg);
791                $("#msgDisplaySendMailError").show();
792                setTimeout(function () {
793                  $("#msgDisplaySendMailError").hide();
794                  $("#msgDisplaySendMailError").text('');
795                }, 3000);
796              }
797            }
798          }
799        });
800      }
801      catch (ex) {
802        $("#ContactExpertPreloader").hide();
803        console.log(ex);
804      }
805    }
806  }
807
808  function CheckValidEmail() {
809    var emailList = [];
810    if (!myAccountCommon.isNullOrEmpty($('#ClientEmailaddress').html())) {
811      emailList = $("#ClientEmailaddress").html().split(';');
812      if (emailList.length > 0) {
813        for (var i = 0; i < emailList.length; i++) {
814          if (!myAccountCommon.IsEmail(emailList[i])) {
815            $("#msgDisplaySendMailError").html(MyAccountConstants.ValidEmailId).show();
816            setTimeout(function () {
817              $("#msgDisplaySendMailError").hide();
818            }, 3000);
819            return false;
820            break;
821          }
822        }
823      }
824    }
825    else {
826      $("#msgDisplaySendMailError").html(MyAccountConstants.EnterEmailId).show();
827      setTimeout(function () {
828        $("#msgDisplaySendMailError").hide();
829      }, 3000);
830      return false;
831    }
832    return true;
833  }
834
835  function CheckTravelexpertSubject() {
836    if (myAccountCommon.isNullOrEmpty($('#SubjectName').val())) {
837      $("#msgDisplaySendMailError").html(MyAccountConstants.ContactTravelExpertSubject).show();
838      setTimeout(function () {
839        $("#msgDisplaySendMailError").hide();
840      }, 3000);
841      return false;
842    }
843    return true;
844  }
845
846  function CheckTravelExpertContent() {
847    if (myAccountCommon.isNullOrEmpty($('#EmailMailContent').val())) {
848      $("#msgDisplaySendMailError").html(MyAccountConstants.ContactTravelExpertMailContent).show();
849      setTimeout(function () {
850        $("#msgDisplaySendMailError").hide();
851      }, 3000);
852      return false;
853    }
854    return true;
855  }
856
857  this.DownloadItinDoc = function (seqno) {
858    try {
859      $.ajax({
860        cache: false,
861        type: "post",
862        url: hostURL + "Common/Download",
863        data: {
864          seqNo: seqno
865        },
866        success: function (result) {
867        },
868        error: function (msg) {
869        }
870      });
871    }
872    catch (ex) {
873      console.log(ex);
874    }
875  }
876
877  this.DeleteItinDoc = function (seqno, docEvent, encyptItinNo) {
878    isDelete = confirm("Do you want to delete?");
879    if (isDelete) {
880      $("#CostRequest_preloader").show();
881      try {
882        $.ajax({
883          cache: false,
884          type: "post",
885          url: hostURL + "Common/DeleteItinDoc",
886          data: {
887            seqNo: seqno
888          },
889          success: function (result) {
890
891            //location.reload();
892            $("#resultId").show();
893            $("#resultId").html("Document deleted successfully");
894            me.ReplacedViewContent('Document', encyptItinNo);
895            $("#CostRequest_preloader").hide();
896          },
897          error: function (msg) {
898          }
899        });
900      }
901      catch (ex) {
902        console.log(ex);
903      }
904    }
905  }
906
907  this.DownloadItinPDF = function (para, BkgNo, branchCode, compressionLevel) {
908    try {
909      console.log('pdf print start');
910      //$('.pdfLoaderMsg').show();
911      $('#popupLoader').show();
912      var customWindow = window.open("");
913      var publishVersion = parseInt($("#PublishVersion").val()) || 0;
914      customWindow.document.write('<h2>' + MyAccountConstants.ItineraryPDFGenerate + '</h2>');
915      $.ajax({
916        cache: false,
917        type: "post",
918        url: hostURL + "Common/pdfConvert",
919        data: {
920          itinearyNo: para,
921          accountName: "",
922          branchCode: branchCode,
923          compressionLevel: compressionLevel,
924          publishVersion: publishVersion,
925        },
926        success: function (result) {
927          //$('.pdfLoaderMsg').hide();
928          $('#popupLoader').hide();
929          if (result != undefined) {
930            console.log(result);
931            //window.open(result);
932            customWindow.location = result;
933          }
934        },
935        error: function (msg) {
936          //$('.pdfLoaderMsg').hide();
937          $('#popupLoader').hide();
938          console.log('pdf print start : error');
939          console.log(msg);
940        }
941      });
942    }
943    catch (ex) {
944      //$('.pdfLoaderMsg').hide();
945      $('#popupLoader').hide();
946      console.log('pdf print start :catch : error');
947      console.log(ex);
948    }
949  }
950
951  this.RedirectToPdfFormatV1 = function (itineraryNo) {
952    $("#itineraryNoPrint").val(itineraryNo);
953    $("#GeneratePDFConfirmation").modal("show");
954  }
955
956  this.RedirectToPdfFormatV1ForA4 = function (itineraryNo, isConsultant) {
957    $("#itineraryNoPrint").val(itineraryNo);
958    var CompanyCode = $('#hdnCompanyCode').val();
959    isgItinerary.OpenGeneratePDFPage('A4', CompanyCode, '', '', isConsultant);
960    //$("#GeneratePDFConfirmation").modal("show");
961  }
962
963  this.OpenGeneratePDFPage = function (printSize, companyCode, printOldItinInd, itineraryNoPrint, isConsultant, isPDFWithImage) {
964    var url = '';
965    var itineraryNo = $("#itineraryNoPrint").val();
966    var publishVersion = parseInt($("#PublishVersion").val()) || 0;
967    if (itineraryNoPrint) {
968      itineraryNo = itineraryNoPrint;
969    }
970    var printOldItin = false;
971    if (printOldItinInd) {
972      printOldItin = printOldItinInd
973    }
974
975    var showOptimisedImgInd = false;
976    if (isConsultant) {
977      showOptimisedImgInd = isConsultant
978    }
979
980    if ((companyCode.toString().toUpperCase() == "RSUS" || companyCode.toString().toUpperCase() == "ITUK" || companyCode.toString().toUpperCase() == "WFUK" || companyCode.toString().toUpperCase() == "ECUK")
981      && isPDFWithImage == undefined) {
982      isPDFWithImage = true;
983    }
984
985    if (!myAccountCommon.isNullOrEmpty(companyCode) && companyCode.toString().toUpperCase() == "STUK") {
986      url = hostURL + "common/pdfFormatV1?itinearyNo=" + itineraryNo + "::" + printSize + "&PrintOldFormat=" + printOldItin;
987    }
988    else if (!myAccountCommon.isNullOrEmpty(companyCode) && companyCode.toString().toUpperCase() == "HAUK") {
989      url = hostURL + "common/pdfFormatV1_HA?itinearyNo=" + itineraryNo + "::" + printSize + "&PrintOldFormat=" + printOldItin;
990    }
991    else if (!myAccountCommon.isNullOrEmpty(companyCode) && companyCode.toString().toUpperCase() == "LTUK") {
992      url = hostURL + "common/pdfFormatV1?itinearyNo=" + itineraryNo + "::" + printSize;
993    }
994    else if (!myAccountCommon.isNullOrEmpty(companyCode) && companyCode.toString().toUpperCase() == "BTUK") {
995      url = hostURL + "common/pdfFormatV1?itinearyNo=" + itineraryNo + "::A5:" + showOptimisedImgInd + "&PrintOldFormat=" + printOldItin;
996    }
997    else if (!myAccountCommon.isNullOrEmpty(companyCode) && (companyCode.toString().toUpperCase() == "FCUK"
998      || companyCode.toString().toUpperCase() == "CLUK") || companyCode.toString().toUpperCase() == "RSUS"
999      || companyCode.toString().toUpperCase() == "ITUK" || companyCode.toString().toUpperCase() == "ASUK"
1000      || companyCode.toString().toUpperCase() == "RMSA" || companyCode.toString().toUpperCase() == "SQUK"
1001      || companyCode.toString().toUpperCase() == "WFUK" || companyCode.toString().toUpperCase() == "CEUS" || companyCode.toString().toUpperCase() == "ECUK") {
1002      url = hostURL + "common/pdfFormatV1?itinearyNo=" + itineraryNo + "::" + printSize + ":" + showOptimisedImgInd + "&PrintOldFormat=" + printOldItin + "&PrintWithImg=" + isPDFWithImage;
1003    }
1004    else {
1005      url = hostURL + "common/pdfFormatV1?itinearyNo=" + itineraryNo + "::" + printSize + ":" + showOptimisedImgInd + "&PrintOldFormat=" + printOldItin + "&publishVersion=" + publishVersion;
1006    }
1007    window.open(url, '_blank');
1008    $("#GeneratePDFConfirmation").modal("hide");
1009  }
1010
1011  this.SavePageBreakXmlAndDwnldGrpItin = function (genericTourCode, DepDate, actualItinNo) {
1012    var customWindow = window.open("");
1013    var PagebreakDivIdList = [];
1014    var RemoveImgDivIdList = [];
1015    $('input[type=checkbox]:checked').each(function () {
1016      PagebreakDivIdList.push($(this).attr('data-val'));
1017    });
1018    $('span[id^="Img_"][class="img_shwblk01 red"]').each(function () {
1019      RemoveImgDivIdList.push($(this).attr('id'));
1020    });
1021    try {
1022      console.log('pdf print start');
1023      customWindow.document.write('<h2>We\'re just preparing your itinerary….</h2>');
1024      $.ajax({
1025        cache: false,
1026        url: hostURL + "Common/mydhruvtourpdfprocess",
1027        data: {
1028          Id: genericTourCode + "|" + DepDate,
1029          ItineraryNo: actualItinNo
1030        },
1031        success: function (result) {
1032          if (result != 'undefined' && result.openPdfPath != 'undefined') {
1033            console.log(result.openPdfPath);
1034            customWindow.location = result.openPdfPath;
1035          }
1036        },
1037        error: function (msg) {
1038          console.log('pdf print start : error');
1039          $("p").html("Something went wrong!! please try again.");
1040          $("img").hide();
1041          console.log(msg);
1042        }
1043      });
1044    }
1045    catch (ex) {
1046      console.log('pdf print start :catch : error');
1047      $("p").html("Something went wrong please try again.");
1048      $("img").hide();
1049      console.log(ex);
1050    }
1051  }
1052
1053  this.DownloadHolidayIdeaPDF = function (itineraryNo) {
1054    try {
1055      console.log('pdf print start');
1056      $('#popupLoader').show();
1057      var customWindow = window.open("");
1058      customWindow.document.write('<h2>We\'re just preparing your itinerary….</h2>');
1059
1060      $.ajax({
1061        cache: false,
1062        url: hostURL + "Common/pdfHoliday",
1063        data: {
1064          itineraryNo: itineraryNo
1065        },
1066        success: function (result) {
1067          $('#popupLoader').hide();
1068          if (result) {
1069            console.log("PDF URL:", result);
1070            customWindow.location = result; 
1071          }
1072        },
1073        error: function (msg) {
1074          $('#popupLoader').hide();
1075          console.log('pdf print start : error');
1076          console.log(msg);
1077        }
1078      });
1079    } catch (ex) {
1080      $('#popupLoader').hide();
1081      console.log('pdf print start :catch : error');
1082      console.log(ex);
1083    }
1084  }
1085
1086  this.SavePageBreakXmlAndDwnldItin = function (itineraryNo, PrintA5Ind, isUpload, BkgNo, PrintOldFormat, branchCode, isConsultant, IsPDFWithImage, IsPDFToWord, publishversion,UserCode) {
1087    var ShowAgentPrice = $('#hdnShowAgentPrice').val();
1088    var PagebreakDivIdList = [];
1089    var RemoveImgDivIdList = [];
1090    $('input[type=checkbox]:checked').each(function () {
1091      PagebreakDivIdList.push($(this).attr('data-val'));
1092    });
1093    $('span[id^="Img_"][class="img_shwblk01 red"]').each(function () {
1094      RemoveImgDivIdList.push($(this).attr('id'));
1095    });
1096    var noofNotesPage = !(typeof $('input[name=noofpage]:checked').val() == "undefined") ? $('input[name=noofpage]:checked').val() : "0";
1097    try {
1098      console.log('pdf print start');
1099      $('#popupLoader').show();
1100      var customWindow = window.open("");
1101      customWindow.document.write('<h2>We\'re just preparing your itinerary….</h2>');
1102      $.ajax({
1103        cache: false,
1104        type: "post",
1105        url: hostURL + "Common/pdfV1Convert",
1106        data: {
1107          itinearyNo: itineraryNo,
1108          pageBreakDivIdList: JSON.stringify(PagebreakDivIdList),
1109          removeImgDivIdList: JSON.stringify(RemoveImgDivIdList),
1110          NoofNotePages: noofNotesPage,
1111          BkgNo: $("#hiddenBkgNo").val(),
1112          QuoteNo: $("#hiddenQuoteNo").val(),
1113          AccountNo: $("#hiddenAccountCode").val(),
1114          isupload: ($("#isUpload").val() || "false"),
1115          PrintA5Ind: PrintA5Ind,
1116          PrintOldFormat: PrintOldFormat,
1117          branchCode: branchCode,
1118          showOptimisedImg: isConsultant,
1119          showAgentPrice: ShowAgentPrice,
1120          isPDFWithImage: IsPDFWithImage,
1121          isPDFToWord: IsPDFToWord,
1122          publishVersion: parseInt(publishversion) || 0,
1123          UserCode: UserCode || ""
1124        },
1125        success: function (result) {
1126          $('#popupLoader').hide();
1127          if (result != undefined) {
1128            console.log(result);
1129            customWindow.location = result;
1130          }
1131
1132            if (IsPDFToWord && customWindow) {
1133              setTimeout(function () {
1134                try {
1135                  customWindow.close();
1136                } catch (e) {
1137                  console.log("Unable to close window:", e);
1138                }
1139              }, 5000); 
1140            }          
1141        },
1142        error: function (msg) {
1143          $('#popupLoader').hide();
1144          console.log('pdf print start : error');
1145          console.log(msg);
1146        }
1147      });
1148    }
1149    catch (ex) {
1150      $('#popupLoader').hide();
1151      console.log('pdf print start :catch : error');
1152      console.log(ex);
1153    }
1154  }
1155
1156  this.SavePageBreakXmlAndDwnldItinPlaywright = function (itineraryNo, PrintA5Ind, isUpload, BkgNo, PrintOldFormat, branchCode, isConsultant, IsPDFWithImage, IsPDFToWord) {
1157    var ShowAgentPrice = $('#hdnShowAgentPrice').val();
1158    var PagebreakDivIdList = [];
1159    var RemoveImgDivIdList = [];
1160    $('input[type=checkbox]:checked').each(function () {
1161      PagebreakDivIdList.push($(this).attr('data-val'));
1162    });
1163    $('span[id^="Img_"][class="img_shwblk01 red"]').each(function () {
1164      RemoveImgDivIdList.push($(this).attr('id'));
1165    });
1166    var noofNotesPage = !(typeof $('input[name=noofpage]:checked').val() == "undefined") ? $('input[name=noofpage]:checked').val() : "0";
1167    try {
1168      console.log('pdf print start');
1169      $('#popupLoader').show();
1170      var customWindow = window.open("");
1171      customWindow.document.write('<h2>We\'re just preparing your itinerary….</h2>');
1172      $.ajax({
1173        cache: false,
1174        type: "post",
1175        url: hostURL + "Common/pdfV1Convertplaywright",
1176        data: {
1177          itinearyNo: itineraryNo,
1178          pageBreakDivIdList: JSON.stringify(PagebreakDivIdList),
1179          removeImgDivIdList: JSON.stringify(RemoveImgDivIdList),
1180          NoofNotePages: noofNotesPage,
1181          BkgNo: $("#hiddenBkgNo").val(),
1182          QuoteNo: $("#hiddenQuoteNo").val(),
1183          AccountNo: $("#hiddenAccountCode").val(),
1184          isupload: ($("#isUpload").val() || "false"),
1185          PrintA5Ind: PrintA5Ind,
1186          PrintOldFormat: PrintOldFormat,
1187          branchCode: branchCode,
1188          showOptimisedImg: isConsultant,
1189          showAgentPrice: ShowAgentPrice,
1190          isPDFWithImage: IsPDFWithImage,
1191          isPDFToWord: IsPDFToWord
1192        },
1193        success: function (result) {
1194          $('#popupLoader').hide();
1195          if (result != undefined) {
1196            console.log(result);
1197            customWindow.location = result;
1198          }
1199
1200            if (IsPDFToWord && customWindow) {
1201              setTimeout(function () {
1202                try {
1203                  customWindow.close();
1204                } catch (e) {
1205                  console.log("Unable to close window:", e);
1206                }
1207              }, 5000); 
1208            }          
1209        },
1210        error: function (msg) {
1211          $('#popupLoader').hide();
1212          console.log('pdf print start : error');
1213          console.log(msg);
1214        }
1215      });
1216    }
1217    catch (ex) {
1218      $('#popupLoader').hide();
1219      console.log('pdf print start :catch : error');
1220      console.log(ex);
1221    }
1222  }
1223
1224  this.SaveItineraryDetailsToLocalDB = function (view, itineraryNo) {
1225    var db = new PouchDB('myAppDb');
1226    var ItineraryDetail = null;
1227    var itineraryNoVersion = itineraryNo + "_" + $("#PublishVersion").val();
1228    db.get(itineraryNoVersion).then(function (ItineraryDetail) {
1229      me.SaveAllObjectsToLocalDb(db, ItineraryDetail, itineraryNo, false);
1230    }).catch(function (err) {
1231      ItineraryDetail = {
1232        _id: itineraryNoVersion,
1233        Version: $("#PublishVersion").val(),
1234        CoverLetter: null,
1235        Itinerary: null,
1236        Accommodation: null,
1237        Notes: null,
1238        Specialists: null,
1239        Cost: null,
1240        Flight: null,
1241        TourLeader: null,
1242        QuickItinerary: null,
1243        Map: null,
1244        TourHighLights: null
1245      }
1246      me.SaveAllObjectsToLocalDb(db, ItineraryDetail, itineraryNo, true);
1247    });
1248
1249    this.SaveAllObjectsToLocalDb = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1250      me.PushItineraryToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata);
1251    }
1252  }
1253
1254  this.PushItineraryToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1255    $.ajax({
1256      cache: false,
1257      async: false,
1258      url: hostURL + "Itinerary/ItineraryViewContent",
1259      data: { ItineraryNo: itineraryNo, publishVersion: parseInt($("#PublishVersion").val()) || 0 },
1260      success: function (resultJson) {
1261        if (resultJson != undefined && resultJson != ItineraryDetail.Itinerary) {
1262          ItineraryDetail.Itinerary = resultJson;
1263          pushalldata = true;
1264        }
1265        me.PushAccomodationToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1266      },
1267      error: function (msg) {
1268        // me.PushAccomodationToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1269      }
1270    });
1271  }
1272
1273  this.PushAccomodationToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1274    $.ajax({
1275      cache: false,
1276      async: true,
1277      url: hostURL + "Itinerary/AccommodationViewContent",
1278      data: { ItineraryNo: itineraryNo, publishVersion: parseInt($("#PublishVersion").val()) || 0 },
1279      success: function (resultJson) {
1280        if (resultJson != undefined && resultJson != ItineraryDetail.Accommodation) {
1281          ItineraryDetail.Accommodation = resultJson;
1282          pushalldata = true;
1283        }
1284        me.PushCoverLetterToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1285      },
1286      error: function (msg) {
1287        // me.PushCoverLetterToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1288      }
1289    });
1290  }
1291
1292  this.PushCoverLetterToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1293    $.ajax({
1294      cache: false,
1295      async: true,
1296      url: hostURL + "Itinerary/CoverLetterViewContent",
1297      data: { ItineraryNo: itineraryNo },
1298      success: function (resultJson) {
1299        if (resultJson != undefined && resultJson != ItineraryDetail.CoverLetter) {
1300          ItineraryDetail.CoverLetter = resultJson;
1301          pushalldata = true;
1302        }
1303        me.PushNotesToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1304      },
1305      error: function (msg) {
1306        // me.PushNotesToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1307      }
1308    });
1309  }
1310
1311  this.PushNotesToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1312    $.ajax({
1313      cache: false,
1314      async: true,
1315      url: hostURL + "Itinerary/NotesViewContent",
1316      data: { ItineraryNo: itineraryNo },
1317      success: function (resultJson) {
1318        if (resultJson != undefined && resultJson != ItineraryDetail.Notes) {
1319          ItineraryDetail.Notes = resultJson;
1320          pushalldata = true;
1321        }
1322        me.PushSpecialistsToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1323      },
1324      error: function (msg) {
1325        // me.PushSpecialistsToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1326      }
1327    });
1328  }
1329
1330  this.PushSpecialistsToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1331    $.ajax({
1332      cache: false,
1333      async: true,
1334      url: hostURL + "Itinerary/SpecialistsViewContent",
1335      data: { ItineraryNo: itineraryNo },
1336      success: function (resultJson) {
1337        if (resultJson != undefined && resultJson != ItineraryDetail.Specialists) {
1338          ItineraryDetail.Specialists = resultJson;
1339          pushalldata = true;
1340        }
1341        me.PushCostToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1342      },
1343      error: function (msg) {
1344        //me.PushCostToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1345      }
1346    });
1347  }
1348
1349  this.PushCostToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1350    $.ajax({
1351      cache: false,
1352      async: true,
1353      url: hostURL + "Itinerary/CostViewContent",
1354      data: { ItineraryNo: itineraryNo },
1355      success: function (resultJson) {
1356        if (resultJson != undefined && resultJson != ItineraryDetail.Cost) {
1357          ItineraryDetail.Cost = resultJson;
1358          pushalldata = true;
1359        }
1360        me.PushFlightToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1361      },
1362      error: function (msg) {
1363        //me.PushFlightToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1364      }
1365    });
1366  }
1367
1368  this.PushFlightToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1369    $.ajax({
1370      cache: false,
1371      async: true,
1372      url: hostURL + "Itinerary/FlightViewContent",
1373      data: { ItineraryNo: itineraryNo },
1374      success: function (resultJson) {
1375        if (resultJson != undefined && resultJson != ItineraryDetail.Flight) {
1376          ItineraryDetail.Flight = resultJson;
1377          pushalldata = true;
1378        }
1379        me.PushTourLeaderToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1380      },
1381      error: function (msg) {
1382        //me.PushTourLeaderToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1383      }
1384    });
1385  }
1386
1387  this.PushTourLeaderToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1388    $.ajax({
1389      cache: false,
1390      async: true,
1391      url: hostURL + "Itinerary/TourLeaderViewContent",
1392      data: { ItineraryNo: itineraryNo },
1393      success: function (resultJson) {
1394        if (resultJson != undefined && resultJson != ItineraryDetail.TourLeader) {
1395          ItineraryDetail.TourLeader = resultJson;
1396          pushalldata = true;
1397        }
1398        me.PushQuickItineraryToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1399      },
1400      error: function (msg) {
1401        //me.PushQuickItineraryToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1402      }
1403    });
1404  }
1405
1406  this.PushQuickItineraryToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1407    $.ajax({
1408      cache: false,
1409      async: true,
1410      url: hostURL + "Itinerary/QuickItineraryViewContent",
1411      data: { ItineraryNo: itineraryNo },
1412      success: function (resultJson) {
1413        if (resultJson != undefined && resultJson != ItineraryDetail.QuickItinerary) {
1414          ItineraryDetail.QuickItinerary = resultJson;
1415          pushalldata = true;
1416        }
1417        me.PushMapToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1418      },
1419      error: function (msg) {
1420        // me.PushMapToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1421      }
1422    });
1423  }
1424
1425  this.PushMapToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1426    $.ajax({
1427      cache: false,
1428      async: true,
1429      url: hostURL + "Itinerary/MapViewContent",
1430      data: { ItineraryNo: itineraryNo },
1431      success: function (resultJson) {
1432        if (resultJson != undefined && resultJson != ItineraryDetail.Map) {
1433          ItineraryDetail.Map = resultJson;
1434          pushalldata = true;
1435        }
1436        me.PushTourHighLightToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1437      },
1438      error: function (msg) {
1439        // me.PushTourHighLightToLocalObject(db, ItineraryDetail, itineraryNo, pushalldata)
1440      }
1441    });
1442  }
1443
1444  this.PushTourHighLightToLocalObject = function (db, ItineraryDetail, itineraryNo, pushalldata) {
1445    $.ajax({
1446      cache: false,
1447      async: true,
1448      url: hostURL + "Itinerary/TourHighLightsViewContent",
1449      data: { ItineraryNo: itineraryNo },
1450      success: function (resultJson) {
1451        if (resultJson != undefined && resultJson != ItineraryDetail.TourHighLights) {
1452          ItineraryDetail.TourHighLights = resultJson;
1453          pushalldata = true;
1454        }
1455        if (pushalldata) {
1456          db.put(ItineraryDetail);
1457        }
1458      },
1459      error: function (msg) {
1460        //if (pushalldata) {
1461        //  db.put(ItineraryDetail);
1462        //}
1463      }
1464    });
1465  }
1466
1467  this.GetPreDepartureCountryText = function (textType, itinNo) {
1468    var counCode = $($(".cntry_info .active")[0]).attr("data-countrycode");
1469    if (counCode) {
1470      $('html,body').animate({ scrollTop: $("#" + counCode + " #" + textType).offset().top - 150 }, 'slow');
1471    }
1472    else {
1473      isgItinerary.ChangeImpInfoMenu('CountryInfoMenu', itinNo, GetPreDepartureCountryTextFunction);
1474      function GetPreDepartureCountryTextFunction() {
1475        counCode = $($(".cntry_info ul.nav-tabs li")[0]).attr("data-countrycode");
1476        if (counCode) {
1477          $('html,body').animate({ scrollTop: $("#" + counCode + " #" + textType).offset().top - 150 }, 'slow');
1478        }
1479      }
1480    }
1481  }
1482
1483  this.OpenAccomTabs = function (element, id, hotelCode, itineraryNo) {
1484    $(element).toggleClass('active');
1485    if ($('#accomtabs_' + id).html().trim().length > 0) {
1486      $('#MoreDetails_' + id).toggle(500);
1487    }
1488    else {
1489      $('#accomtabs_' + id).html('<div class="loader_icon" style="background-image: url(' + hostURL + 'Content/BR/Images/UK/loader.svg); width: 100%; height: 200px; background-repeat: no-repeat; background-position: center;"></div>').show();
1490      $('html,body').animate({ scrollTop: $('#accomtabs_' + id).offset().top - 150 }, 'slow');
1491      $.ajax({
1492        cache: false,
1493        async: true,
1494        url: hostURL + "Itinerary/GetAccomodationTabDetails",
1495        data: {
1496          ItineraryNo: itineraryNo,
1497          HotelCode: hotelCode,
1498          Id: id
1499        },
1500        success: function (resultJson) {
1501          if (resultJson != undefined && resultJson != null) {
1502            $('#accomtabs_' + id).html(resultJson);
1503            //$('#MoreDetails_' + id).show();
1504            var selectedRoomType = $('#hdnHotelRmTypeDesc_' + id).val();
1505            var selectedRoomTypeCode = "";
1506
1507            if ($("#roomType_" + id).length > 0) {
1508              $("#roomType_" + id + " option").filter(function () {
1509                if (this.text == selectedRoomType) {
1510                  selectedRoomTypeCode = this.value;
1511                }
1512              });
1513            }
1514            if (!myAccountCommon.isNullOrEmpty(selectedRoomTypeCode)) {
1515              $("#roomType_" + id).val(selectedRoomTypeCode).trigger("onchange");
1516            }
1517            $('#MoreDetails_' + id).toggle(500);
1518            isgItinerary.initFlexSliders(id);
1519          }
1520        },
1521        error: function (msg) {
1522          //$('#accomtabs_' + id).html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>').hide();
1523          console.log(msg);
1524        }
1525      })
1526    }
1527  }
1528
1529  this.initFlexSliders = function (id) {
1530    $('.accd_slides_' + id).flexslider({
1531      animation: "slide",
1532      touch: true,
1533      directionNav: true,
1534      isFirefox: true,
1535      prevText: "",
1536      nextText: "",
1537      slideshowSpeed: 7000,
1538      animationSpeed: 2000,
1539      itemWidth: 960,
1540      init: function (slider) {
1541        // lazy load
1542        //$("img.lazy").slice(0, 2).each(function () {
1543        //$(slider).find(".accom-slider-li.flex-active-slide").width(960);
1544        $(slider).find(".accom-slider-li.flex-active-slide").next().find("img.lazy").slice(0, 2).each(function () {
1545          var src = $(this).attr("data-src");
1546          //$(this).parent().width(960);
1547          if (src) {
1548            $(this).attr("src", src).removeAttr("data-src").removeClass("lazy");
1549          }
1550        });
1551      },
1552      start: function (slider) {
1553        if (slider.itemW != 960) {
1554          $('.accd_slides_' + id).data('flexslider').resize();
1555        }
1556      },
1557      after: function (slider) {
1558        if (!slider.playing) {
1559          slider.play();
1560        }
1561      },
1562      before: function (slider) {
1563        // lazy load
1564        if (slider.itemW != 960) {
1565          $('.accd_slides_' + id).data('flexslider').resize();
1566        }
1567        //$("img.lazy").slice(0, 1).each(function () {
1568        $(slider).find(".accom-slider-li.flex-active-slide").next().find("img.lazy").slice(0, 1).each(function () {
1569          //if (slider.itemW != 960) {
1570          //  $(this).parent().width(960);
1571          //}
1572          var src = $(this).attr("data-src");
1573          if (src) {
1574            $(this).attr("src", src).removeAttr("data-src").removeClass("lazy");
1575          }
1576        });
1577      }
1578    });
1579
1580    //$('.accd_slides_' + id).data('flexslider').resize();
1581
1582  };
1583
1584  this.loadCompDetails = function (ElementType, id, element, itineraryNo) {
1585    var CpntType = $("#CpntType").val();
1586    var CpntCode = id;
1587    var ElementCode = $('#' + element.id + ' option:selected').val()
1588    var classname = '';
1589    //accd_room_txt room_01_86_5485
1590
1591    if (ElementType.toUpperCase() == "ROOMTYPE") {
1592      var Id = 'accd_room_txt room_01 ' + CpntCode + ' ' + ElementCode
1593      classname = '.accd_room_txt';
1594    }
1595    if (ElementType.toUpperCase() == "RESTAURANT") {
1596      var Id = 'restnt_txt rest_01 ' + CpntCode + ' ' + ElementCode
1597      classname = '.restnt_txt';
1598    }
1599    if (ElementType.toUpperCase() == "ACTIVITY") {
1600      var Id = 'actvty_txt actvt_01 ' + CpntCode + ' ' + ElementCode
1601      classname = '.actvty_txt';
1602    }
1603    $(classname).each(function () {
1604      //if ($(this).hasClass(CpntCode) && $(this).hasClass(ElementCode)) {
1605      if ($(this).hasClass(CpntCode)) {
1606        if ($(this).hasClass(ElementCode)) {
1607          $(this).show();
1608        }
1609        else {
1610          $(this).hide()
1611        }
1612      }
1613      else {
1614        // $(this).hide()
1615      }
1616    });
1617  }
1618
1619  this.SavePageBreakXml = function (itineraryNo, PrintA5Ind, isUpload, BkgNo, PrintOldFormat, branchCode) {
1620    var PagebreakDivIdList = [];
1621    var RemoveImgDivIdList = [];
1622    $('input[type=checkbox]:checked').each(function () {
1623      PagebreakDivIdList.push($(this).attr('data-val'));
1624    });
1625    $('span[id^="Img_"][class="img_shwblk01 red"]').each(function () {
1626      RemoveImgDivIdList.push($(this).attr('id'));
1627    });
1628    var noofNotesPage = !(typeof $('input[name=noofpage]:checked').val() == "undefined") ? $('input[name=noofpage]:checked').val() : "0";
1629    try {
1630      $("#btnSavexml").attr("disabled", true)
1631      $('#popupLoader').show();
1632      $("#xmlSavedSuccess").hide();
1633      $.ajax({
1634        cache: false,
1635        type: "post",
1636        url: hostURL + "Common/SavePageBreakXml",
1637        data: {
1638          itinearyNo: itineraryNo,
1639          pageBreakDivIdList: JSON.stringify(PagebreakDivIdList),
1640          removeImgDivIdList: JSON.stringify(RemoveImgDivIdList),
1641          NoofNotePages: noofNotesPage,
1642          //BkgNo: $("#hiddenBkgNo").val(),
1643          //QuoteNo: $("#hiddenQuoteNo").val(),
1644          //AccountNo: $("#hiddenAccountCode").val(),
1645          //isupload: ($("#isUpload").val() || "false"),
1646          PrintA5Ind: PrintA5Ind,
1647          PrintOldFormat: PrintOldFormat,
1648          //branchCode: branchCode
1649        },
1650        success: function (result) {
1651          $('#popupLoader').hide();
1652          $("#xmlSavedSuccess").text("Saved successfully").show();
1653          $("#btnSavexml").attr("disabled", false)
1654          if (result != undefined) {
1655            console.log(result);
1656          }
1657        },
1658        error: function (msg) {
1659          $("#xmlSavedSuccess").hide();
1660          $("#btnSavexml").attr("disabled", false)
1661          $('#popupLoader').hide();
1662          //console.log('pdf print start : error');
1663          console.log(msg);
1664        }
1665      });
1666    }
1667    catch (ex) {
1668      $('#popupLoader').hide();
1669      // console.log('pdf print start :catch : error');
1670      console.log(ex);
1671    }
1672  }
1673
1674  this.GenerateOnlinePaymentLinkExternally = function (BkgNo, AccountCode) {
1675    try {
1676      $.ajax({
1677        cache: false,
1678        type: "post",
1679        url: hostURL + "Common/GenerateOnlinePaymentLinkExternally",
1680        data: {
1681          bkgNo: BkgNo,
1682          AcctCode: AccountCode
1683        },
1684        success: function (result) {
1685          window.open(result, '_blank');
1686        },
1687        error: function (msg) {
1688        }
1689      });
1690    }
1691    catch (ex) {
1692      console.log(ex);
1693    }
1694  }
1695
1696  this.ExportDocument = function (seqNo, documentPath) {
1697    if (!myAccountCommon.isNullOrEmpty(seqNo)) {
1698      var url = hostURL + "/Common/ExportDocument?seqNo=" + seqNo;
1699      window.open(url, "_blank");
1700    }
1701    else {
1702      var url = hostURL + "/Common/ExportDocument?documentPath=" + documentPath;
1703      window.open(url, "_blank");
1704    }
1705  }
1706
1707  this.changeNotesval = function () {
1708    var text = $("#txtNotes").val();
1709    $("#hdnnotes").val(text);
1710    $("#hdndocumentSubType").val(document.getElementById("docsubtype").value);
1711  }
1712
1713  this.DownloadtourPDF = function (itineraryNo) {
1714    try {
1715      window.location = hostURL + "Common/PreviewFinalDoc?itineraryNo=" + itineraryNo;
1716    }
1717    catch (ex) {
1718      console.log('pdf print start :catch : error');
1719      $("p").html("Something went wrong please try again.");
1720      $("img").hide();
1721      console.log(ex);
1722    }
1723  }
1724
1725  this.GenerateFinalDocPDF = function () {
1726    try {
1727      var BookingNo = $("#BookingNo").val();
1728      var QuoteNo = $("#QuoteNo").val();
1729      var ItineraryNo = $("#ItineraryNo").val();
1730      var PagebreakDivIdList = [];
1731      $('input[type=checkbox]:checked').each(function () {
1732        PagebreakDivIdList.push($(this).attr('data-val'));
1733      });
1734      $('#popupLoader').show();
1735      var customWindow = window.open("");
1736      customWindow.document.write('<h2>PDF is generating</h2>');
1737      $.ajax({
1738        cache: false,
1739        url: hostURL + "Common/GenerateFinalDocPDF",
1740        type: "POST",
1741        data: {
1742          itinearyNo: ItineraryNo,
1743          bookingNo: BookingNo,
1744          quoteNo: QuoteNo,
1745          pageBreakDivIdList: JSON.stringify(PagebreakDivIdList),
1746        },
1747        beforeSend: function () {
1748          $(".loader").html('<img  alt="" src=' + hostURL + 'images/ajax-loader.gif></img>');
1749        },
1750        success: function (resultJson) {
1751          $('#popupLoader').hide();
1752          if (resultJson != undefined) {
1753            console.log(resultJson);
1754            customWindow.location = resultJson;
1755          }
1756        },
1757        error: function (msg) {
1758          $('#popupLoader').hide();
1759        }
1760      });
1761    }
1762    catch (ex) {
1763      $('#popupLoader').hide();
1764      console.log('pdf print start :catch : error');
1765      $("p").html("Something went wrong please try again.");
1766      $("img").hide();
1767      console.log(ex);
1768    }
1769  }
1770
1771  this.OpenUrlPath = function (Url, FileName) {
1772    window.open(Url, '_blank');
1773  }
1774
1775  this.SavePageBreakXmlAndDwnldItinInMobileView = function (itineraryNo, PrintA5Ind, isUpload, BkgNo, PrintOldFormat, branchCode, isConsultant, IsPDFWithImage) {
1776    var customWindow = window.open("");
1777    var ShowAgentPrice = $('#hdnShowAgentPrice').val();
1778    var PagebreakDivIdList = [];
1779    var RemoveImgDivIdList = [];
1780    $('input[type=checkbox]:checked').each(function () {
1781      PagebreakDivIdList.push($(this).attr('data-val'));
1782    });
1783    $('span[id^="Img_"][class="img_shwblk01 red"]').each(function () {
1784      RemoveImgDivIdList.push($(this).attr('id'));
1785    });
1786    var noofNotesPage = !(typeof $('input[name=noofpage]:checked').val() == "undefined") ? $('input[name=noofpage]:checked').val() : "0";
1787    try {
1788      console.log('pdf print start');
1789      $('#popupLoader').show();
1790      var publishversion = $("PublishVersion").val();
1791      $.ajax({
1792        cache: false,
1793        type: "post",
1794        url: hostURL + "Common/pdfV1Convert",
1795        data: {
1796          itinearyNo: itineraryNo,
1797          pageBreakDivIdList: JSON.stringify(PagebreakDivIdList),
1798          removeImgDivIdList: JSON.stringify(RemoveImgDivIdList),
1799          NoofNotePages: noofNotesPage,
1800          BkgNo: $("#hiddenBkgNo").val(),
1801          QuoteNo: $("#hiddenQuoteNo").val(),
1802          AccountNo: $("#hiddenAccountCode").val(),
1803          isupload: ($("#isUpload").val() || "false"),
1804          PrintA5Ind: PrintA5Ind,
1805          PrintOldFormat: PrintOldFormat,
1806          branchCode: branchCode,
1807          showOptimisedImg: isConsultant,
1808          showAgentPrice: ShowAgentPrice,
1809          isPDFWithImage: IsPDFWithImage,
1810          publishVersion: publishversion
1811        },
1812        success: function (result) {
1813          $('#popupLoader').hide();
1814          if (result != undefined) {
1815            console.log(result);
1816            customWindow.location = result;
1817          }
1818        },
1819        error: function (msg) {
1820          $('#popupLoader').hide();
1821          console.log('pdf print start : error');
1822          console.log(msg);
1823        }
1824      });
1825    }
1826    catch (ex) {
1827      $('#popupLoader').hide();
1828      console.log('pdf print start :catch : error');
1829      console.log(ex);
1830    }
1831  }
1832
1833  this.loadAnalytics = function (accountCode, quoteNo, bkgNo, itineraryNo, analyticUrl) {
1834    debugger
1835    sessionStorage.setItem('account_code', accountCode);
1836    sessionStorage.setItem('quote_no', quoteNo);
1837    sessionStorage.setItem('booking_no', bkgNo);
1838    sessionStorage.setItem('itinerary_no', itineraryNo);
1839    window.ANALYTICS_CONFIG = {
1840      TRACKING_SERVER: analyticUrl,
1841      SITE_ID: 'mydhruv',
1842
1843      // Maps analytics field name → sessionStorage key used by THIS app
1844      SESSION_STORAGE_KEYS: {
1845        account_code: 'account_code',
1846        booking_no: 'booking_no',
1847        quote_no: 'quote_no',
1848        itinerary_no: 'itinerary_no',
1849      }
1850    }
1851  }
1852
1853}

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.