@extends('admin/layouts/default')

{{-- Page title --}}
@section('title')
Edit Discipline Article
@parent
@stop

{{-- page level styles --}}
@section('header_styles')
    @include('admin.layouts.css')
<!--page level css -->
<link href="{{ asset('assets/vendors/select2/css/select2.min.css') }}" type="text/css" rel="stylesheet">
<link href="{{ asset('assets/vendors/select2/css/select2-bootstrap.css') }}" rel="stylesheet">
<!--end of page level css-->
@stop

{{-- Page content --}}
@section('content')
<section class="content-header">
                <!--section starts-->
                <h1>Manage Discipline</h1>
                <ol class="breadcrumb">
                    <li>
                        <a href="{{ route('admin.dashboard') }}">
                            <i class="livicon" data-name="home" data-size="14" data-loop="true"></i>
                            Dashboard
                        </a>
                    </li>
                    <li ><a href="{{ URL::to('admin/discipline-article') }}">Discipline Article List</a></li>
                    <li class="active">
                        	Edit Discipline Article
                    </li>
                </ol>
            </section>
            <!--section ends-->
<section class="content paddingleft_right15">
    <!--main content-->
    <div class="row">
        <div class="panel panel-primary ">
            <div class="panel-heading">
                <h3 class="panel-title">
                    Edit Discipline Article
                </h3>
            </div>
            <div class="panel-body">
                <form name="first" method="post" action="{{ route('update-discipline-article',$selected_discipline->disc_art_id) }}" enctype="multipart/form-data">

                <input type="hidden" name="_token" value="<?=csrf_token()?>">

                 @if ($errors->any())
                    <div class="row">
                        <div class="col-md-12 alert-danger">
                            <strong>Whoops!</strong> There were some problems with your input.<br>
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    </div>
                @endif 

                @if ($error = Session::get('error'))
                    <div class="alert alert-danger alert-dismissable">
                        <p>{{ $error }}</p>
                    </div>
                @endif

                <div id="banner" class="panel">
                    <div class="panel-body">
                        <div class="form-group col-md-12">
                            <label for="e1" class="control-label">Discipline Name: *</label>
                            <select class="form-control select2" id="discipline_id" name="discipline_id" required>
                                <option selected="true" value="" disabled="disabled" hidden>Select Discipline</option>
                                @foreach($discipline as $value)

                                    @if (old('discipline_id') == $value->discipline_id)
                                        <option value="{{$value->discipline_id}}" selected>{{$value->discipline_name}}   @if($value->discipline_status == 0) (Deleted) @endif</option>
                                    @elseif (isset($selected_discipline) &&  $selected_discipline->discipline_id == $value->discipline_id)
                                        <option value="{{$value->discipline_id}}" selected>{{$value->discipline_name}} @if($selected_discipline->discipline_status == 0) (Deleted) @endif </option>
                                    @else
                                        <option value="{{$value->discipline_id}}">{{$value->discipline_name}}  @if($value->discipline_status == 0) (Deleted) @endif</option>
                                    @endif

                                @endforeach 
                            </select>
                        </div>

                        <div class="form-group col-md-12">
                            <label for="e1" class="control-label">Article DOI:</label>
                            <input type="text" name="doi" class="form-control input-md" placeholder="Place DOI here..." required="required" value="{{$selected_discipline->doi}}">
                        </div>

                        <div class="form-group text-center col-md-12">
                            <button class="btn btn-primary text-center" type="submit">Update Discipline</button>
                        </div>

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

    </div>
    <!--main content ends--> </section>
            <!-- content --> 
    @stop

{{-- page level scripts --}}
@section('footer_scripts')
<script src="{!! asset('assets/vendors/select2/js/select2.js') !!}"></script>    
<script src="{!! asset('js/filter.js') !!}"></script>
<script>

$(document).ready(function(){
    
    $("#discipline_id").select2({
        theme:"bootstrap",
        placeholder:"Select Discipline",
        width: '100%',
        height: '50px'
    });
   
});    
</script>
    @include('admin.layouts.js')

@stop
