@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">Set server</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif
                    <form action="/virtuals/{{$virtual->id}}/setnetwork" method="get">
                        @csrf
                        <div class="form-group row">
                            <label for="Newserver" class="col-md-4 col-form-label text-md-right">Server</label>
                            <div class="col-md-6">                            
                                <select name="newserver" id="newserver" class="form-control">  
                                    @forelse ($servers as $server)
                                        <option <?php if( $virtual->server_id==$server->id){ echo "selected"; } ?> value={{$server->ip}}>{{$server->ip}}</option>
                                    @empty
                                        <p>No systems to choose from</p>
                                    @endforelse                                
                                </select>
                                <br>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary">
                            Update
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
