Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('select[name="tour_name"]').change(function () {
- $('#tour_name').empty();
- var $val = $(this).val();
- $(this).hide();
- $('#tour_name').fadeIn('slow').append('<b>' + $val + '</b>');
- $(".myGrid").hide().slideToggle('slow');
- $('#main_admin').css('width', '1200px');
- $('#tour_name b').click(function () {
- $('#tour_name').empty().hide();
- $(".myGrid").hide();
- $('#main_admin').css('width', '500px');
- $('select[name="tour_name"]').fadeIn('slow')();
- })
- $('ol#guide_name, ol#residence_name').empty(); // baraye in ke ba har taghir ++1 nashan tag <li>
- var dataString = $('form').serialize();
- $.ajax({
- type: "POST",
- dataType: "json",
- url: 'get_gr',
- data: dataString,
- cache: false,
- success: function(data){
- //var ac = $(this).text();
- //var ul = $.grep(data, function (e) {
- // return e.name == ac;
- //});
- //alert(ul);
- $.each(data[0].hotel_id, function (index, value) {
- var $li = $('<li><input name="hotel_id[]" value="' + value.hotel_id + '" style="display:none;"></li>');
- var $tooltip = $('<div class="tooltip"></div>').appendTo($li);
- $li.appendTo('#residence_name');
- var info_ru = data[0].residence_u[index];
- $.each(info_ru.units, function (index, value) {
- $tooltip.append(value + ' & ' + info_ru.extra[index] + ' & ' + info_ru.price[index] + '<br>');
- });
- var info_rp = data[0].residence_p[index];
- $.each(info_rp.start_date, function (index, value) {
- $tooltip.append(value + ' & ' + info_rp.end_date[index] + ' & ' + info_rp.price_change[index] + '<br>');
- });
- tool_tip()
- });
- var dataString_h = $('form').serialize();
- //alert(dataString_h)
- $.ajax({
- type: "POST",
- dataType: "json",
- url: 'get_residence',
- data: dataString_h,
- cache: false,
- success: function(respond){
- //alert(respond);
- if(respond == 0){
- alert('nono');
- }else{
- $.each(respond.data, function (index, value) {
- $('#residence_name li').eq(index).append('<a href="" class="tool_tip" title="ok">' + value.name + '</a>');
- //alert(value.name);
- $.each(value.service, function () {
- $('#residence_name li .tooltip').eq(index).append(this + '، ');
- });
- $('#residence_name li .tooltip').eq(index).append(value.star_type);
- tool_tip()
- });
- }
- },
- "error": function (x, y, z) {
- alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
- }
- });
- $('ol#guide_name li').live('click', function(e){
- e.preventDefault();
- var val = this.id;
- $('.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>');
- $('ol#guide_name').hide();
- $('#width_change').css('width','300px');
- $('.adda').show();
- $('.guide_select .adda:last .mediumCell:first').hide().fadeIn('slow').append('<a href="" class="add_input"></a>');
- $('.guide_select .adda:last .mediumCell:last').hide().fadeIn('slow').append('<a href="" class="remove_input"></a>');
- var ngs = $('.new_guide').size();
- if(ngs > 1){
- $('.new_guide:last').remove();
- }
- //$(this).hide();
- $(".each_guide .chr").each(function(){
- $(".new_guide #guide_name li:contains("+$(this).text()+")").remove();
- });
- //alert($('#guide_name li').size());
- if($('#guide_name li').size() == 0 ){
- $('.guide_select .adda:last .mediumCell:first').remove();
- }
- });
- $('ol#residence_name li').live('click', function(e){
- e.preventDefault();
- //$('').hide();
- alert('hello')
- });
- },
- "error": function (x, y, z) {
- // callback to run if an error occurs
- alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
- }
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement