@extends('themes.base.layout')
@section('title', 'Gallery Admin')

@section('breadcrumb')
    <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
    <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
    <li class="breadcrumb-item"><a href="{{ route('albums.index') }}">@lang('navigation.breadcrumb.albums')</a></li>
    <li class="breadcrumb-item active">@lang('navigation.breadcrumb.create_album')</li>
@endsection

@section('content')
    <div class="container">
        <div class="row">
            <div class="col">
                <h1>@lang('admin.create_album')</h1>
                <p>@lang('admin.create_album_intro')</p>
                <p>@lang('admin.create_album_intro2')</p>
                <hr/>

                <form action="{{ route('albums.store') }}" method="POST">
                    {{ csrf_field() }}
                    <div class="form-group">
                        <label class="form-control-label" for="album-name">@lang('forms.name_label')</label>
                        <input type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" id="album-name" name="name" value="{{ old('name') }}">

                        @if ($errors->has('name'))
                            <div class="invalid-feedback">
                                <strong>{{ $errors->first('name') }}</strong>
                            </div>
                        @endif
                    </div>

                    <div class="form-group">
                        <label class="form-control-label" for="album-description">@lang('forms.description_label')</label>
                        <textarea class="form-control" id="album-description" name="description" rows="5">{{ old('description') }}</textarea>
                    </div>

                    <div class="form-group">
                        <label class="form-control-label" for="parent-album">@lang('forms.parent_album_label')</label>
                        <select class="form-control" name="parent_album_id" id="parent-album">
                            <option value="">@lang('forms.parent_album_placeholder')</option>
                            @foreach ($parent_albums as $key => $value)
                                <option value="{{ $key }}"{{ $key == old('parent_album_id') ? ' selected="selected"' : '' }}>{{ $value->display_name }}</option>
                            @endforeach
                        </select>
                    </div>

                    <div class="form-group">
                        <label class="form-control-label" for="album-source">@lang('forms.album_source_label')</label>
                        <select class="form-control" name="storage_id" id="album-source">
                            @foreach ($album_sources as $key => $value)
                                <option value="{{ $key }}"{{ $key == old('storage_id') ? ' selected="selected"' : '' }}>{{ $value }}</option>
                            @endforeach
                        </select>
                    </div>

                    <div class="form-check">
                        <label class="form-check-label">
                            <input class="form-check-inline" type="checkbox" name="is_private">
                            <i class="fa fa-fw fa-lock"></i> @lang('forms.private_album_label')
                        </label>
                    </div>

                    <div class="text-right">
                        <a href="{{ route('albums.index') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
                        <button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection