<!-- Lead Id Field -->
<div class="form-group col-sm-6">
    {!! Form::label('lead_id', 'Lead Id:') !!}
    {!! Form::select('lead_id',$leads, null, ['class' => 'form-control select2 lead']) !!}
</div>

<!-- Production Team Id Field -->
<div class="form-group col-sm-6">
    {!! Form::label('production_team_id', 'Production Team Id:') !!}
    {!! Form::select('production_team_id', $teams, null, ['class' => 'form-control select2 team']) !!}
</div>

@if(empty($order) )
<!-- Sales Person Id Field -->
<div class="form-group col-sm-6" style="display:none">
    {!! Form::label('sales_person_id', 'Sales Person Id:') !!}
    {!! Form::hidden('sales_person_id',$user, null, ['class' => 'form-control', 'placeholder'=>'Enter sales_person_id','required']) !!}
</div>
@endif


<!-- Link Field -->
<div class="form-group col-sm-6">
    {!! Form::label('link', 'Link:') !!}
    {!! Form::text('link', null, ['class' => 'form-control link', 'placeholder'=>'Enter link','required']) !!}
</div>

<!-- User Name Field -->
<div class="form-group col-sm-6">
    {!! Form::label('user_name', 'User Name:') !!}
    {!! Form::text('user_name', null, ['class' => 'form-control user', 'placeholder'=>'Enter user_name','required']) !!}
</div>

<!-- Password Field -->
<div class="form-group col-sm-6">
    {!! Form::label('password', 'Password:') !!}
    {!! Form::text('password', null, ['class' => 'form-control password', 'placeholder'=>'Enter password','required']) !!}
</div>

<!-- Portal Field -->
<div class="form-group col-sm-6">
    {!! Form::label('portal', 'Portal:') !!}
    {!! Form::text('portal', null, ['class' => 'form-control portal', 'placeholder'=>'Enter portal','required']) !!}
</div>
<!-- Deadline Field -->
@if(\Entrust::hasRole('admin') || \Entrust::hasRole('super-admin'))
@if(isset($order))
<div class="form-group col-sm-6">
    {!! Form::label('deadline', 'Deadline:') !!}
    <input type="date" name="deadline" class="form-control" value="{{date('Y-m-d', strtotime($order->deadline))}}">
</div>
@else
<div class="form-group col-sm-6">
    {!! Form::label('deadline', 'Deadline:') !!}
    <input type="date" name="deadline" class="form-control">
</div>
@endif
@else
@if(isset($order))
<div class="form-group col-sm-6">
    {!! Form::label('deadline', 'Deadline:') !!}
    <input type="date" name="deadline" class="form-control" value="{{date('Y-m-d', strtotime($order->deadline))}}" readonly>
</div>
@else
<div class="form-group col-sm-6">
    {!! Form::label('deadline', 'Deadline:') !!}
    <input type="date" name="deadline" class="form-control">
</div>
@endif
@endif

<!-- Status Field -->
<div class="form-group col-sm-6">
    {!! Form::label('status_id', 'Status*:') !!}
    <div class="clearfix"></div>
    {!! Form::select('status_id',\App\Models\Order::$TYPES, null, ['class' => 'form-control select2 status' ,'required' ,'id'=>'type_check']) !!}
</div>
<!-- Production User Id Field -->

@if(!empty(\Auth::user()->details->is_production_team_lead == 1) || (\Auth::user()->details->is_production_team_lead == 2))
<div class="form-group col-sm-6 production">
    {!! Form::label('production_user_id', 'Production User Id:') !!}
    {!! Form::select('production_user_id',$team_user, null, ['class' => 'form-control select2']) !!}
</div>
@endif
@if(empty($order->id))
<!-- Comments Field -->
<div class="form-group col-sm-12 col-lg-12">
    {!! Form::label('comments', 'Previous Comments:',['class'=>'label_comment']) !!}
    {!! Form::textarea('comments', null, ['class' => 'form-control comment previous','readonly']) !!}
</div>
@push('scripts')
<script>
    $('.label_comment').text('New Comments');
    $('.previous').removeAttr('readonly');
    $('.previous').attr('rows','3');

</script>
@endpush
@else
@push('scripts')
<script>
    $('.label_comment').text('Previous Comments');
</script>
@endpush
<div class="form-group col-sm-12 col-lg-12">
    {!! Form::label('comments', 'Previous Comments:',['class'=>'label_comment']) !!}
    {!! Form::textarea('comments', null, ['class' => 'form-control previous','readonly','rows'=>'2']) !!}
</div>
<div class="form-group col-sm-12 col-lg-12">
    {!! Form::label('new_commentss', 'New Comments:') !!}
    {!! Form::textarea('new_commentss', null, ['class' => 'form-control new']) !!}
    {!! Form::hidden('comments', null, ['class' => 'form-control updated']) !!}
</div>
@endif
@push('scripts')
<script>
    $(document).ready(function(){
        $('.btn_edit').click(function(e){
            $('.new').hide();
            $('.previous').removeAttr('readonly');
        });
        var prevs = $('.previous').val();
        $('.new').on('change',function(){
            var nee=$('.new').val();
            var comments=prevs+'\n'+nee; 
            $('.updated').val(comments);
        });
    });
</script>
@endpush
@if((\Auth::user()->details->production_team_id == 2) || (\Auth::user()->details->production_team_id == 1 && !(\Entrust::hasRole('admin') || \Entrust::hasRole('super-admin'))) )
@push('scripts')
<script>
    $('.lead').attr('disabled','disabled');
    $('.team').attr('disabled','disabled');
    $('.link').attr('disabled','disabled');
    $('.user').attr('disabled','disabled'); 
    $('.password').attr('disabled','disabled');
    $('.portal').attr('disabled','disabled');
    $('.deadline').attr('disabled','disabled');

</script>
@endpush
@endif
<!-- Image Field -->
<div class="form-group col-sm-6">
    {!! Form::label('attachments', 'Attachments:') !!}
    {!! Form::file('attachments', ['class' => 'form-control'  ,'multiple','id'=>'upload_file']) !!}
</div>
<!-- Submit Field -->
<div class="form-group col-sm-12">
    {!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}
    <a href="{!! route('admin.orders.index') !!}" class="btn btn-default">Cancel</a>
</div>