@extends('layout.default')
@section('content')
<div class="row">
    <div class="col-xs-12 col-sm-12">
        <div class="box">
            <div class="box-content my_content">
                 @if ($errors->has())
                    <div class="alert alert-danger">
                        @foreach ($errors->all() as $error)
                            {!! $error !!}<br>        
                        @endforeach
                    </div>
                @endif
                <h5 class="page-header"><b>
                        Source 
                    @if(isset($source_to_edit))
                        Update
                    @else
                        Entry 
                    @endif 
                        Form
                </b></h5>
                @if(isset($source_to_edit))    
                    {!! Form::open(array('class' => 'form-horizontal','role' => 'form','action' => 'SourceController@update','method' => 'POST','accept-charset' => 'ISO-8859-1')) !!} 
                @else
                    {!! Form::open(array('class' => 'form-horizontal','role' => 'form','action' => 'SourceController@store','method' => 'POST','accept-charset' => 'ISO-8859-1')) !!}          
                @endif 
                <div class="form-group">  
                        {!! Form::label('name', 'Name', array('class' => 'col-sm-2 control-label')) !!}
                    <div class="col-sm-4">
                        @if(isset($source_to_edit))
                        {!! Form::text('source_name',$source_to_edit->source_name,['required'=>'required','class'=>'form-control'])!!}
                        {!! Form::hidden('source_id',$source_to_edit->id,['required'])!!}
                        @else
                        {!! Form::text('source_name','',['required'=>'required','class'=>'form-control'])!!} 
                        @endif 
                    </div>                        
                    <div class="col-sm-4"></div>
                </div>        
                    
                <div class="form-group">                            
                    <div class="col-sm-4"></div>
                    <div class="col-sm-4">
                        @if(isset($source_to_edit))
                        {!! Form::submit('Update', array('class' => 'btn btn-primary btn-label-left')) !!}
                        @else                           
                        {!! Form::submit('Save', array('class' => 'btn btn-primary btn-label-left')) !!}
                        @endif 
                    </div>
                </div>                    
                {!! Form::close() !!}                
            </div>
        </div>
    </div>
</div>
@stop