@extends('layouts.main')

@section('content')

<section class="content-header">
    <h1>Permission Management</h1>
    <ol class="breadcrumb">
        <li><a href="/home"><i class="fa fa-dashboard"></i>Home</a></li>
        <li><a href="#">Management</a></li>
        <li><a href="/permissions">Permission</a></li>
        <li class="active">Create</li>
    </ol>
</section>

<hr style="border: 3px groove #3c8dbc;">

@if (count($errors) > 0)

    <div class="alert alert-danger">

        <strong>Whoops!</strong> There were some problems with your input.<br><br>

        <ul>

        @foreach ($errors->all() as $error)

            <li>{{ $error }}</li>

        @endforeach

        </ul>

    </div>

@endif

<section class="content">
  <div class="col-md-12">
    <div class="box box-info">
      
      <div class="box-header">
        <lable><b>Product Name:</b></lable>
        <lable>{{$item->product_name}} </lable>
        <input type="hidden" value="{{ $item->id }}" id="productid">
      </div>
      
      <div class="box-body">
        <button type="submit" id="submitRelationButton">Submit</button>
        <table class="display" id="relationtable" style="width:100%">
          <thead>
            <tr>
              <th></th> 
              <th>Id</th>  
              <th> Iteams Name</th>
            </tr>
          </thead>
         
          <tbody>
            
            @foreach($allIteams as $display)
           
            <tr class=" {{isset($selectedProduct)? (in_array($display->product_id,$selectedProduct) ? 'selected':'') :''}}">
              <td>  {{$display->id}}  </td>
              <td></td>
              <td>{{ $display->product_name }}</td>
            </tr>
            @endforeach
          </tbody>
        </table>
      </div>
    </div>
  </div>
</section>

{!! Form::close() !!}



@endsection