@extends('admin/layouts/default')
{{-- Page title --}}
@section('title')
Update Sustainable Development Goals
@parent
@stop
{{-- page level styles --}}
@section('header_styles')

<link href="{{ asset('assets/vendors/summernote/summernote.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('assets/css/pages/editor.css') }}" rel="stylesheet" type="text/css" />
<!-- end of page level css-->

@stop
{{-- Page content --}}
@section('content')
<section class="content-header">
    <!--section starts-->
    <h1>Update Sustainable Development Goals</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/sdg') }}">Sustainable Development Goals List</a></li>
        <li class="active">
            Update Sustainable Development Goals
        </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">
                    Sustainable Development Goals
                </h3>
            </div>
            <div class="panel-body">
                <div id="banner" class="panel">
                    <div class="panel-body">
                        <form name="myForm" method="post" action="{{ route('sdg.update',$selected_sdg->sdgs_id) }}" enctype="multipart/form-data" onsubmit="return validateForm()">@method('PUT')

                            <input type="hidden" name="_token" value="<?= csrf_token() ?>">
                            <div class="form-group col-md-9 {{ $errors->first('title', 'has-error') }}">
                                <label for="e1" class="control-label">Title: *</label>
                                <input type="text" class="form-control" name="title" value="{{$selected_sdg->title}}" required="required">
                                <div>
                                    <span class="text-danger">{{ $errors->first('title') }}</span>
                                </div>
                            </div>

                            <div class="form-group col-md-3 {{ $errors->first('sequence_no', 'has-error') }}">
                                <label class="control-label" for="press_release_date">Sequence Number: *</label>
                                <input type="number" class="form-control" name="sequence_no" value="{{$selected_sdg->sequence_no}}" required="required">
                                <div>
                                    <span class="text-danger">{{ $errors->first('sequence_no') }}</span>
                                </div>
                            </div>

                            <div class="form-group col-md-12 {{ $errors->first('description', 'has-error') }}">
                                <label for="e1" class="control-label">Description: *</label>
                                <div class='box-body box_content'>
                                    <textarea id="summernote" name="description">{{$selected_sdg->description}}</textarea>
                                </div>
                                <div>
                                    <span class="text-danger">{{ $errors->first('description') }}</span>
                                </div>
                            </div>

                            <div class="form-group text-center col-md-12">
                                <button class="btn btn-primary text-center" type="submit">Submit</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <!--main content ends-->
</section>
@stop
<!-- content -->
{{-- page level scripts --}}
@section('footer_scripts')
<script>
    function validateForm() {
        let x = document.forms["myForm"]["description"].value;
        if (x == "") {
            alert("Description must be filled out!");
            return false;
        }
    }
</script>
<script src="{{ asset('assets/vendors/bootstrap3-wysihtml5-bower/js/bootstrap3-wysihtml5.all.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/vendors/summernote/summernote.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/js/pages/editor2.js') }}" type="text/javascript"></script>
@stop