@extends('admin/layouts/default')

{{-- Page title --}}
@section('title')
Update Disease
@parent
@stop

{{-- page level styles --}}
@section('header_styles')
     @include('admin.layouts.css')

@stop

{{-- Page content --}}
@section('content')

<section class="content-header">
                <!--section starts-->
                <h1>Update Disease</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/disease') }}">Disease List</a></li>
                    <li class="active">Update Disease</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">
                    <i class="livicon" data-name="gear" data-size="16" data-loop="true" data-c="#fff" data-hc="white"></i>
                    Disease
                </h3>
                <span class="pull-right clickable">
                    <i class="glyphicon glyphicon-chevron-up"></i>
                </span>
            </div>
            <div class="panel-body">               
                <form name="first" method="post" action="{{ route('disease.update',$disease->disease_id) }}" enctype="multipart/form-data"> @method('PUT')  
                    <input type="hidden" name="disease_id" value="{{$disease->disease_id}}">                
               
                    <input type="hidden" name="_token" value="<?=csrf_token()?>">
             @if ($errors->any())
                <div class="row">
                    <div class="col-md-9 col-lg-offset-3 col-md-offset-3 pd-r lert 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                    
                <div class="row acc-wizard">
                    <div class="col-md-3 pd-2">
                        <p class="mar-2">
                            Follow the steps below to add new disease.
                        </p>
                        <ol class="acc-wizard-sidebar">
                            <li class="acc-wizard-todo">
                                <a href="#disease">Disease</a>
                            </li>     
                                                 
                       </ol>
                    </div>
                    <div class="col-md-9 pd-r">
                        <div id="accordion-demo" class="panel-group">
                            <!-- /.panel.panel-default -->
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h4 class="panel-title">
                                        <a href="#disease" data-parent="#accordion-demo" data-toggle="collapse">Disease</a>
                                    </h4>
                                </div>
                                <div id="disease" class="panel-collapse collapse">
                                    <div class="panel-body">
                                        <div class="form-group  {{ $errors->first('disease_name', 'has-error') }}">
                                            <label for="disease_name" class="control-label">Disease Name</label>
                                            <input type="text" name="disease_name" id="disease_name" class="form-control input-md" placeholder="Disease Name" value="{{ old('disease_name',isset($disease->disease_name) ? $disease->disease_name : '') }}">                            
                                        </div>
                                        <div class="form-group {{ $errors->first('keywords', 'has-error') }}">
                                            <label for="keywords" class="control-label">Search Keyword:</label>
                                           <textarea class="form-control resize_vertical" rows="5" placeholder="Place some text here" name="keywords" id="keywords">{{ old("keywords",isset($disease->keywords) ? $disease->keywords : '') }}</textarea>
                                           

                                        </div>
                                        <div class="form-group {{ $errors->first('description', 'has-error') }}">
                                            <label for="description" class="control-label">Description:</label>
                                            <textarea class="form-control resize_vertical"  rows="5" placeholder="Place some text here" name="description" id="description">{{ old("description",isset($disease->disease_desc) ? $disease->disease_desc : '') }}</textarea>
                                            <div>
                                                <span class="text-danger">{{ $errors->first('description') }}</span>
                                            </div>
                                        </div>
                                        <div class="form-group {{ $errors->first('sequence_no', 'has-error') }}">
                                            <label for="sequence_no" class="control-label">Sequence:</label>
                                            <input type="number" name="sequence_no" id="sequence_no" class="form-control input-md" placeholder="sequence number" 
                                                value="{{ old('sequence_no',isset($disease->sequence_no) ? $disease->sequence_no : '') }}"
                                                >
                                            <div>
                                                <span class="text-danger">{{ $errors->first('sequence_no') }}</span>
                                            </div>
                                        </div>
                                        <div class="form-group  {{ $errors->first('parent_id', 'has-error') }}">
                                            <label for="parent_id" class="control-label">Parent</label>
                                            
                                            <select name="parent_id" id="parent_id" class="form-control select2" placeholder="Select Parent Disease">
                                                @for($i=0;$i<count($parent_disease_select);$i++)
                                                    <option value="{{$parent_disease_select[$i]['id']}}" @if($disease->parent_id==$parent_disease_select[$i]['id']) selected @endif >{{$parent_disease_select[$i]['name']}}</option>
                                                @endfor
                                            </select>
                                            
                                            <span class="help-block">{{ $errors->first('parent_id', ':message') }}</span>
                                        </div>
                                                
                                    </div>
            <!--/.panel-body --> </div>

        <!-- /#adjusthtml --> </div>
                                                        
                            <!-- /.panel.panel-default --> 
                            
                            
                    </div>
                      <button class="btn btn-primary" type="submit">Save</button>      
                </div>
                
            </form>
            </div>
        </div>

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

{{-- page level scripts --}}
@section('footer_scripts')

    @include('admin.layouts.js')
    <script src="{{asset('js/access.js')}}" ></script>
    <script>
        $(".select2").select2({
            theme:"bootstrap",
            placeholder:"",
            width: '100%'
        });

        $("#start_date,#end_date").datetimepicker({
            format: 'YYYY-MM-DD',
            widgetPositioning:{
                vertical:'bottom'
            },
            keepOpen:false,
            useCurrent: false,            
        });

        
    $('#alljournals').click(function(){
        
        if($('#alljournals').prop('checked')){            
            $("#journal_div").hide();  
        }else{
            $("#journal_div").show();  
        }
    });
     $('#allebooks').click(function(){
        
        if($('#allebooks').prop('checked')){            
            $("#ebook_div").hide(); 
        }else{
            $("#ebook_div").show();  
        }
    });

    $('.ctype').click(function(){
                
        if($('.ctype').prop('checked')){                          
            $("#countrybase").show();  
            $("#ipbase").hide();  
        }else{

            $("#countrybase").hide();  
            $("#ipbase").show();  
        }
    });

        function findselected() {            
                
                if($("#discount_code_type").val()=="Single"){      
                    $('#no_of_discount_code').prop("disabled", true);
                }if($("#discount_code_type").val()=="Multi"){                    
                    $('#no_of_discount_code').prop("disabled", false);
                }
            }
    

           function formatState (state) {
            if (!state.id) { return state.text; }
            var $state = $(
                '<span><img src="{{ asset('assets/img/countries_flags') }}/'+ state.element.value.toLowerCase() + '.png" class="img-flag" width="20px" height="15px" /> ' + state.text + '</span>'
            );
            return $state;

        }
        $("#countries").select2({
            templateResult: formatState,
            templateSelection: formatState,
            placeholder: "select a country",
            theme:"bootstrap"
        });

    </script>

@stop
