<script type="text/javascript">



function storeInventoryCategory(event,obj)
{

    event.preventDefault();
    var obj = $('#form_add_category');
    var route = obj.attr('action');
    var formdata = obj.serialize();

        showLoader();

    $.post(route, formdata, function(result)
    {

      if(result.id)
        {
          var view = '<option value = "'+result.id+'">'+result.category_code+' | '+result.name+'</option>';
          $('.product_category').append(view);
           $('.service_category').append(view);



        $('#md_add_category').modal('hide');

          messageToaster('success','Category has been successfully  added.','Success');

        }
        else if(result.success == false)
        {
          alert('Name/Code already found');

        }
        removeLoader();


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

      });


}

function storeInventoryUnit(event,obj)
{

    event.preventDefault();
    var obj = $('#form_add_unit');
    var route = obj.attr('action');
    var formdata = obj.serialize();

        showLoader();

    $.post(route, formdata, function(result)
    {

      if(result.id)
        {



          var view = '<option value = "'+result.id+'">'+result.name+'</option>';
          $('.product_unit').append(view);
           $('.service_unit').append(view);



        $('#md_add_unit').modal('hide');

          messageToaster('success','Unit has been successfully  added.','Success');

        }
        else if(result.success == false)
        {
          alert('Name already found');

        }
        removeLoader();


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

      });


}

function showInventoryModal(form_id,modal_id,type)
{
      $('#'+form_id)[0].reset();

      $('.category_type').val(type);

     $('#'+modal_id).modal('show');



}

</script>
<?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/inventory_module/scripts/item.blade.php ENDPATH**/ ?>