Advertisement
Guest User

Untitled

a guest
Sep 28th, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $('select[name="tour_name"]').change(function () {
  2.         $('#tour_name').empty();
  3.         var $val = $(this).val();
  4.         $(this).hide();        
  5.         $('#tour_name').fadeIn('slow').append('<b>' + $val + '</b>');
  6.         $(".myGrid").hide().slideToggle('slow');
  7.         $('#main_admin').css('width', '1200px');
  8.         $('#tour_name b').click(function () {
  9.             $('#tour_name').empty().hide();
  10.             $(".myGrid").hide();
  11.             $('#main_admin').css('width', '500px');
  12.             $('select[name="tour_name"]').fadeIn('slow')();
  13.         })
  14.         $('ol#guide_name, ol#residence_name').empty(); // baraye in ke ba har taghir ++1 nashan tag <li>
  15.         var dataString = $('form').serialize();
  16.         $.ajax({
  17.             type: "POST",
  18.             dataType: "json",
  19.             url: 'get_gr',
  20.             data: dataString,
  21.             cache: false,
  22.             success: function(data){
  23.                     //var ac = $(this).text();
  24.                     //var ul = $.grep(data, function (e) {
  25.                     //    return e.name == ac;
  26.                     //});
  27.                     //alert(ul);                    
  28.                 $.each(data[0].hotel_id, function (index, value) {
  29.                     var $li = $('<li><input name="hotel_id[]" value="' + value.hotel_id + '" style="display:none;"></li>');
  30.                     var $tooltip = $('<div class="tooltip"></div>').appendTo($li);
  31.                     $li.appendTo('#residence_name');
  32.                    
  33.                     var info_ru = data[0].residence_u[index];
  34.                     $.each(info_ru.units, function (index, value) {
  35.                         $tooltip.append(value + ' & ' + info_ru.extra[index] + ' & ' + info_ru.price[index] + '<br>');
  36.                     });
  37.                    
  38.                     var info_rp = data[0].residence_p[index];
  39.                     $.each(info_rp.start_date, function (index, value) {
  40.                         $tooltip.append(value + ' & ' + info_rp.end_date[index] + ' & ' + info_rp.price_change[index] + '<br>');
  41.                     });                                        
  42.                     tool_tip()
  43.                 });
  44.                 var dataString_h = $('form').serialize();
  45.                 //alert(dataString_h)
  46.                 $.ajax({
  47.                     type: "POST",
  48.                     dataType: "json",
  49.                     url: 'get_residence',
  50.                     data: dataString_h,
  51.                     cache: false,
  52.                     success: function(respond){
  53.                         //alert(respond);
  54.                         if(respond == 0){
  55.                             alert('nono');
  56.                         }else{
  57.                             $.each(respond.data, function (index, value) {
  58.                                 $('#residence_name li').eq(index).append('<a href="" class="tool_tip" title="ok">' + value.name + '</a>');
  59.                                 //alert(value.name);
  60.                                 $.each(value.service, function () {
  61.                                     $('#residence_name li .tooltip').eq(index).append(this + '، ');
  62.                                 });
  63.                                 $('#residence_name li .tooltip').eq(index).append(value.star_type);
  64.                                 tool_tip()
  65.                             });
  66.                         }
  67.                     },
  68.                     "error": function (x, y, z) {
  69.                         alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
  70.                     }
  71.                 });
  72.                 $('ol#guide_name li').live('click', function(e){
  73.                     e.preventDefault();
  74.                     var val = this.id;
  75.                     $('.guide_select').hide().fadeIn('slow').append('<div class="each_guide"><div class="mediumCell row_gn"><div class="column chr">'+val+'<input type="text" name="guides" value="'+val+'" style="display:none;"></div><div class="column"><input type="text" name="a[]" class="numeric" placeholder="تعرفه" style="width:65px; margin-top: 0px; direction: ltr; text-align: left;"></div></div><div class="column adda" style="margin: 5px 10px 0 0"><div class=mediumCell></div><div class=mediumCell></div></div></div>');
  76.                     $('ol#guide_name').hide();
  77.                     $('#width_change').css('width','300px');
  78.                     $('.adda').show();
  79.                    
  80.                         $('.guide_select .adda:last .mediumCell:first').hide().fadeIn('slow').append('<a href="" class="add_input"></a>');
  81.                         $('.guide_select .adda:last .mediumCell:last').hide().fadeIn('slow').append('<a href="" class="remove_input"></a>');
  82.                    
  83.                     var ngs = $('.new_guide').size();
  84.                     if(ngs > 1){
  85.                         $('.new_guide:last').remove();
  86.                     }
  87.                     //$(this).hide();
  88.                     $(".each_guide .chr").each(function(){
  89.                         $(".new_guide #guide_name li:contains("+$(this).text()+")").remove();
  90.                     });
  91.                     //alert($('#guide_name li').size());
  92.                     if($('#guide_name li').size() == 0 ){
  93.                         $('.guide_select .adda:last .mediumCell:first').remove();
  94.                     }
  95.                 });
  96.                 $('ol#residence_name li').live('click', function(e){
  97.                     e.preventDefault();
  98.                     //$('').hide();
  99.                     alert('hello')
  100.                 });
  101.                
  102.             },
  103.             "error": function (x, y, z) {
  104.                 // callback to run if an error occurs
  105.                 alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
  106.             }
  107.         })
  108.     })
  109.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement