@extends('backend/layouts/layout')
@section('container')
@section('certificate_select', 'active')
<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
      @if(session()->has('msg'))
          <div class="alert alert-danger" role="alert">
            {{session('msg')}}
          </div>
        @endif
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">Certificate</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active">Add certificate</li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
        <div class="row">
        <div class="col-md-12">
            <!-- general form elements -->
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Certificate</h3>
              </div>
              <!-- /.card-header -->
              <!-- form start -->
              <form action="{{route('manage_certificate_process')}}" method="post" enctype="multipart/form-data">
                @csrf
                  <div class="form-group col-12">
                    <label for="exampleInputEmail1">Title</label>
                    <input type="text" name="title" value="{{$title}}" class="form-control" id="exampleInputEmail1" placeholder="Enter title">
                  </div>
                  @error('title')
                  <div class="alert alert-danger" role="alert">
                  {{$message}}
                  </div>
                  @enderror
                  <div class="form-group col-12">
                    <label for="exampleInputEmail1">Description</label>
                    <textarea name="descr" class="form-control" placeholder="Enter Slider description">{{$descr}}</textarea>
                  </div>
                  @error('descr')
                  <div class="alert alert-danger" role="alert">
                  {{$message}}
                  </div>
                  @enderror

                  @php
                  if($id>0){
                    $image_required="";
                  }
                  else{
                    $image_required="required";
                  }
                  @endphp
                  <div class="form-group col-12">
                    <label for="exampleInputEmail1">Image</label>
                    <input type="file" name="image" class="form-control" id="exampleInputEmail1" {{$image_required}}>
                  </div>
                  @error('image')
                  <div class="alert alert-danger" role="alert">
                  {{$message}}
                  </div>
                  @enderror
                
                <!-- /.card-body -->

                <div class="card-footer">
                  <button type="submit" name="Save" class="btn btn-primary">Submit</button>
                </div>
                
                <input type="hidden" name="id" value="{{$id}}">
              </form>
            </div>
            <!-- /.card -->

            <!-- general form elements -->
            
            <!-- /.card -->

            <!-- Input addon -->
           
          
            <!-- /.card -->

          </div>
<!-- /.col -->
        </div>
        <!-- /.row -->
        <!-- Main row -->
       
        <!-- /.row (main row) -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  @endsection