<script type="text/javascript">
	$('.feature_list').change(function(){

		var plot_features = '';

		$('.feature_list').each(function(){

			if($(this).prop('checked'))
			{
				plot_features = plot_features+$(this).prop('value')+', ';
			}
		});


		plot_features = plot_features.slice(0, plot_features.trim().length-1);
		$('.plot_features_des').html(plot_features);
	});

    function showUpdatePlotModel(event,plot)
      {
          event.preventDefault();

          var route = "<?php echo e(url('showplot')); ?>/"+plot;
         
          showLoader();

          $.get(route,function(data)
          {
              $('#update_plot_modal').html(data);
              $('#md_update_inventory').modal('show');

              removeLoader();

          },'html') .fail(function(data) {
     
              messageToaster('error','Record not found.','Failed');
              
              removeLoader();
        
            });
      }

    function verifyCategory(event,obj,key_element)
    {
      $('.floor_section_'+key_element).show();
    	obj = $(obj);

    	var plot_category = $('.plot_category option');

      if($(obj).val() == "House" || $(obj).val() == "Villa")
      {
          $('.floor_section_'+key_element).hide();
      }

    	// if(obj.val() == "Shop" && obj.val() != "selected")
      if(true)

    	{
    		plot_category.each(function(){

    			// if($(this).attr('value') == "Shop")
          if(true)

    			{
    				$(this).show();
    				$(this).attr('selected',true);
    			}
    			else
    			{
    				$(this).hide();
    				$(this).removeAttr('selected',false);
    			}
    		});
    	}
        else if(obj.val() == "Office" && obj.val() != "selected")
        {

            plot_category.each(function(){

                if($(this).attr('value').trim() == "Office")
                {
                    $(this).show();
                    $(this).attr('selected',true);
                }
                else
                {
                    $(this).hide();
                    $(this).removeAttr('selected',false);
                }
            });
        }
    	else if(obj.val() != "selected" && $(this).attr('value') != "Shop" || $(this).attr('value') != "Office")
    	{
    		plot_category.each(function(){

    			if($(this).attr('value') == "Shop" || $(this).attr('value') == "Office")
    			{
    				$(this).hide();
    				$(this).removeAttr('selected',false);
    			}
    			else
    			{
    				$(this).show();
    			}
    		});
    	}
    	else
    	{
        
    		plot_category.first().prop('selected',true);
    		plot_category.first().show();

    	}
    }

    // AJAX REQUEST TO STORE INVENTORY 
    function storeInventory(event,obj)
    {
        event.preventDefault();
        var obj = $('#form_add_inventory');
        var route = obj.attr('action');     
        var formdata = obj.serialize();
                     
        showLoader();

        $.post(route, formdata, function(result)
        {
            if(result.id)
            {
                $('#md_add_inventory').modal('hide');

                $('#md_make_booking').modal('show');

         
                messageToaster('success','Article has been added.','Success');
                    
            }
        removeLoader();


        },'json')
        .fail(function(data) {
                   ajax_show_error(data);
            
          });    
    }


    function projectWiseBlock(event,object,key_element)
    {
        event.preventDefault();

        // resetInventorySection(false,key_element);

        object = $(object).val();

        var route = "<?php echo e(url('projectwiseblocks')); ?>/"+object;

        $('.other_block_section_'+key_element).hide();
         $('.normal_other_block_'+key_element).val('');
            removeFieldRequired($('.normal_other_block_'+key_element));

        showLoader();
                $.get(route,function(data)
                {
                    $('.normal_block_'+key_element).html(data);
                    
                    // $('.master_block_list').html(data);
                    removeLoader();
                }) .fail(function(data) {

        
        messageToaster('error','Required form validation.','Failed');
      
     
        removeLoader();

    });


  }

  function showOtherBlockField(event,obj,key_element)
  {
      obj = $(obj).val();



      if(obj === "Other")
      {
          $('.other_block_section_'+key_element).show();
    
          $('.normal_other_block_'+key_element).val('');

            // fieldRequired($('.normal_other_block_'+key_element));

      }
      else
      {
        
         $('.other_block_section_'+key_element).hide();
         $('.normal_other_block_'+key_element).val('');
            // removeFieldRequired($('.normal_other_block_'+key_element));

      }
  }
  function blockWisePlots(event,block_object,branch_object,key,target){
    block = $(block_object).val();
    branch = '.'+branch_object;
    
    showParameterBranchWiseDataTable(event,branch,block,key,target)
}
 
</script><?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/scripts/inventory.blade.php ENDPATH**/ ?>