@extends('frame',['front' => false]) 

@section('title', 'The Bad Space | Edit '.$title)

  @section('main-content')
    @parent
    <section class="edit-location">
      <article>
        <h2>Editing {{$title}}</h2>
        <form class="location-edit" action="/den/locations/edit" method="post" enctype="multipart/form-data">
          @csrf
          <label>Edit Location Name</label><br>
          <input type="text" name="name" value="{{$location->name}}" /><br>
          <label>Edit Location Comments</label><br>
          <textarea name="description">{{$location->description}}</textarea><br>
          <label>Edit Reference Links (comma seperated)</label><br>
          <textarea name="archive_links">{{$location->archive_links}}</textarea><br>
          <label>Edit Reference Images</label><br>
          <input type="file" name="references[]" accept="image/png, image/jpeg, image/gif" / multiple><br />
          <input type="hidden" name="id" value={{$location->uuid}} />
          <input type="submit" value="Edit {{$location->name}}" name="submit_button">
        </form>
        <h2>References</h2>
        <h3>Images</h3>
        @if($images != null)
          @foreach($images as $image)
            <a href="/{{$image->path}}" class="location-image" style="background: url(/{{$image->path}}) no-repeat center center / cover #fc6399" />
            </a>
          @endforeach
        @endif
        @php
          $action = $location->block_count + $location->silence_count;
          $rating = ($action / $sources_count)*100;
        @endphp
        <h3>Links</h3>
        @foreach($archive_links as $link)
          @php
            $link = trim($link);
          @endphp
          <a href="https://{{$link}}" target="_blank">{{$link}}</a><br />
        @endforeach

        <br />LAST UPDATED : {{$updated}}
      </article>
    </section>
  @endsection