

  <div class="modal fade" id="md_tansfer_stock_product" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  {{ Form::open(array('route' => 'commit.transfer' , 'id' => 'form_add_transfer', 'class' => 'cls_form' , 'method' => 'POST' , 'enctype'=>'multipart/form-data'
)) }}
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Transfer Product Stock</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true"></span>
        </button>
      </div>
      <div class="modal-body ">
        <div class ="card">
          <div class = "card-body form-fieldset">
          <div class="row">

            <div class="col-sm-12">
              <label>Project</label>
              @php($branch_label = EF::branchWhiteLabel())
              <select name="{{$branch_label['module']}}1" class="form-control form-control-sm cls_selection branch" id="b_id1" onChange="getPlotTypeList(event,this)">
                 <option value="{{Crypt::encrypt(0)}}">Select {{ucwords(str_replace('_',' ',$branch_label['module']))}} From</option>
                @foreach($branch as $rows)
                @if(Auth::user()->usertoprojectCheck($rows->id) == 1 || Auth::user()->type="Super Admin")
                  <option @if(isset($current_branch) && $rows->id === $current_branch) selected  @endif value="{{Crypt::encrypt($rows->id)}}">{{$rows->code}} {{$rows->name}}</option>
                  @endif
                @endforeach
              </select>
            </div>

            <div class="col-sm-12">
            <label class="label-color"> Product: <i style = "color:red;">*</i></label>
            <div class="input-group mb-3">
              <select class="form-control" id="product_id" required name="product_id" onChange ="getItemList(event,this)">
                <option value="{{Crypt::encrypt(0)}}">Select Product</option>
                @foreach($product_list as $product)
                <option value="{{Crypt::encrypt($product->id)}}">{{$product->name}}</option>
                @endforeach
              </select>
            </div>
            </div>

            <div class="col-sm-12">
            <label class="label-color" id="qtylabel"> Quantity: <i style = "color:red;">*</i></label>
            <div class="input-group mb-3">
              <input type="number" name="quantity" class="form-control " min="0" required id="quantity" />
            </div>
            </div>

            <div class="col-sm-12">
              <label>Project</label>
                @include('layouts.common.branch')
            </div>

            <div class="col-sm-12">
            <label class="label-color"> Remarks: <i style = "color:red;">*</i></label>
            <div class="input-group mb-3">
              <input type="text" name="remarks" class="form-control " required id="remakrs" />
            </div>
            </div>


        </div>
          </div>
        </div>
      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

        <button type="submit" onClick="storeInventoryUnit(event,this)" class="btn btn-primary"   content="add unit">Transfer</button>

      </div>
      {{ Form::close() }}
    </div>
  </div>

</div>

<script>

function getItemList(event,obj)
{
      event.preventDefault();
      var project_id = $("#b_id1").val();

    var route = "{{url('/getitemid')}}/"+$(obj).val()+'/'+project_id;

      showLoader();

  $.get(route,function(data)
  {

    if(data['msg'] == "success")
    {
      $("#qtylabel").html('Quantity: <i style = "color:red;">*</i>(max|'+data['item']+')')
      $("#quantity").attr({
       "max" : data['item'],
       "min" : 1
    });
    }
    else
    {
      $("#qtylabel").html('Quantity: <i style = "color:red;">*</i>(max|0')
      $("#quantity").attr({
       "max" : 0,
       "min" : 0
    });
    }


       removeLoader();

    });
}
</script>
