assets/js/custom (another copy).js
//getting  exists products according to promo code name from promtion table ----- edit mode ---- start
getting  exists products according to promo code name from promtion table  edit mode ---- start
getting exists products according to promo code name from promtion table edit mode ---- start
function common_getting_restauant_product_or_category_id_by_promo_code_name(selected_restaurant_id,applied_on){
       $.ajax({
          url: BASE_URL+'admin/show_restaurant_product_or_category_according_promo_code_name',
          data:{promotion_code_name:edit_promotion_code_name, checked_restaurant_id:selected_restaurant_id,level_id:applied_on},
          type: 'post',
          success: function(response){
            if(response != 0){
               var json = JSON.parse(response,true);
                 $.each(json,function(index,json){
                    if(applied_on == 1 || applied_on == 2){
                      $('#restaurant_id_'+json.restaurant_id).attr('checked','checked');
                    }else if(applied_on == 3){
                      $('#product_id_'+json.applied_on_id).attr('checked','checked');
                    }else if(applied_on == 4){
                      $('#category_id_'+json.applied_on_id).attr('checked','checked');
                    }
                    if(logged_in_restaurant_id != ""){
                        $('#restaurant_id_'+json.restaurant_id).attr('checked','checked');
                    }
                }); 
            } 
             if(response == 0 && logged_in_restaurant_id != ""){
                $('#restaurant_id_'+logged_in_restaurant_id).attr('checked','checked');
              }
          },
      });
  }
function common_getting_restauant_product_or_category_id_by_promo_code_name ( selected_restaurant_id , applied_on ) { $ . ajax ( { url : BASE_URL + 'admin/show_restaurant_product_or_category_according_promo_code_name' , data : { promotion_code_name : edit_promotion_code_name , checked_restaurant_id : selected_restaurant_id , level_id : applied_on } , type : 'post' , success : function ( response ) { if ( response != 0 ) { var json = JSON . parse ( response , true ) ; $ . each ( json , function ( index , json ) { if ( applied_on == 1 || applied_on == 2 ) { $ ( '#restaurant_id_' + json . restaurant_id ) . attr ( 'checked' , 'checked' ) ; } else if ( applied_on == 3 ) { $ ( '#product_id_' + json . applied_on_id ) . attr ( 'checked' , 'checked' ) ; } else if ( applied_on == 4 ) { $ ( '#category_id_' + json . applied_on_id ) . attr ( 'checked' , 'checked' ) ; } if ( logged_in_restaurant_id != "" ) { $ ( '#restaurant_id_' + json . restaurant_id ) . attr ( 'checked' , 'checked' ) ; } } ) ; } if ( response == 0 && logged_in_restaurant_id != "" ) { $ ( '#restaurant_id_' + logged_in_restaurant_id ) . attr ( 'checked' , 'checked' ) ; } } , } ) ; }
getting  exists products according to promo code name from promtion table ----- edit mode ---- start
getting exists products according to promo code name from promtion table ----- edit mode ---- start
//get  product or category detail according to applied on value and promo code name //product dropdown  //product dropdown  //category dropdown  //merchant logged restaurant id  //when change level id  than its response will be 0 at the edit time because data not avaialble corresponding of selected level id //ajax end