@extends('adminlte::page')
@section('content_header')
    @notifyCss
    @notifyJs
@stop
@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card card-primary">
                <div class="card-header">
                    <h3 class="card-title">View Assigned Contents</h3>
                </div>
                @include('notify::messages')
                <!-- /.card-header -->
                <!-- form start -->
                <form id="userregform" class="form-horizontal" action="#" method="post" autocomplete="off" enctype="multipart/form-data">
                  {{ csrf_field() }}
                  <div class="card-body">
                      <div class="col-12">
                          <div class="form-group row">
                              <div class="col-4">
                                  <label for="exampleInputEmail1">Content Type</label><br>
                                  {{$contents->content_type->content_type_name}}
                              </div>
                              <div class="col-4">
                                  <label for="exampleInputEmail1">Content Name</label><br>
                                  {{$contents->content_subject}}
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Description</label><br>
                                  {{$contents->description}}
                              </div>
                              <div class="col-1">
                                <a href="{{URL::to('/assign_content')}}" class="btn btn-danger pull-right">Back</a>
                              </div>
                          </div>
                          <div id="listroledata" style="padding: 10px;">
                              <table class="table table-hover table-bordered table-striped datatable" id="dept_details" width="100%">
                                  <thead>
                                      <tr class="success">
                                        <th>Slno</th>
                                        <th>Organisation</th>
                                        <th>Department</th>
                                        <th>Section</th>
                                        <th>Material Type</th>
                                        <th>Material Subtype</th>
                                        <th>Topic</th>
                                      </tr>
                                  </thead>
                                  <tbody>
                                    @php
                                      $n= 0;
                                    @endphp
                                    @if(isset($content_assignments))
                                      @foreach($content_assignments as $content_assignment)
                                        @php
                                          $n++;
                                        @endphp
                                        <tr>
                                          <td>{{$n}}</td>
                                          <td>{{$content_assignment->organisation->organisation_name}}</td>
                                          <td>{{$content_assignment->department->department_name}}</td>
                                          <td>{{$content_assignment->section->section_name}}</td>
                                          <td>{{$content_assignment->materialtype->material_type_name}}</td>
                                          <td>{{$content_assignment->materialsubtype->material_subtype_name}}</td>
                                          <td>{{$content_assignment->topic->topic_name}}</td>
                                        </tr>
                                      @endforeach
                                    @else
                                      <tr>
                                        <td colspan="7">
                                            <span style="color: red;">This Content is not assigned yet !!!</span>
                                        </td>
                                      </tr>
                                    @endif
                                  </tbody>
                              </table>
                          </div>                        
                      </div>
                  </div>
                  <!-- /.card-body -->
                </form>
            </div>
        </div>        
    </div>
@stop
