@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Edit server</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif
                    <form action="{{ route('servers.update', $server) }}" method="POST">
                        @csrf
                        {{ method_field('PUT') }}
                        <div class="form-group row">

                            <label for="name" class="col-md-4 col-form-label text-md-right">Name of new system</label>
                            <div class="col-md-6">
                                <input value="{{$server->name}}" name="name" id="name" type="text"/>
                            </div>
                            <label for="name" class="col-md-4 col-form-label text-md-right"></label>
                            <div class="col-md-6">
                                <p style="color: red">@error('name') {{ $message }} @enderror</p>
                            </div>

                            <label for="ip" class="col-md-4 col-form-label text-md-right">IP adress</label>
                            <div class="col-md-6">
                                <input value="{{$server->ip}}" name="ip" id="ip" type="text"/>
                            </div>
                            <label for="ip" class="col-md-4 col-form-label text-md-right"></label>
                            <div class="col-md-6">
                                <p style="color: red">@error('ip') {{ $message }} @enderror</p>
                            </div>

                            <label for="script" class="col-md-4 col-form-label text-md-right">Path to scripts</label>
                            <div class="col-md-6">
                                <table>
                                    <tr>
                                      <td>
                                          <input value="{{$server->scripts}}" name="scripts" id="scripts" type="text" />
                                      </td>
                                    </tr>
                                  </table>
                                  <p style="color: red">@error('scripts') {{ $message }} @enderror</p>
                            </div>
                            <br>
                            <label for="template" class="col-md-4 col-form-label text-md-right">Path to templates</label>
                            <div class="col-md-6">
                                <table>
                                    <tr>
                                      <td>
                                          <input value="{{$server->templates}}" name="templates" id="templates" type="text"  />
                                      </td>
                                    </tr>
                                  </table>
                                  <p style="color: red">@error('templates') {{ $message }} @enderror</p>
                            </div>
                            <br>
                            <label for="Clones" class="col-md-4 col-form-label text-md-right">Clones location</label>
                            <div class="col-md-6">
                                <table>
                                    <tr>
                                      <td>
                                          <input value="{{$server->clones}}" name="clones" id="clones" type="text"  />
                                      </td>
                                    </tr>
                                  </table>
                                  <p style="color: red">@error('clones') {{ $message }} @enderror</p>
                            </div>
                            <label for="Clones" class="col-md-4 col-form-label text-md-right">SSH Private key</label>
                            <div class="col-md-6">
                                <table>
                                        <label class=" col-form-label text-md-right">{{$server->private}}</label>
                                  </table>
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    Update
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
