@extends('admin.layout')
@section('admin-title')
{{ $advent->id ? 'Edit' : 'Create' }} Advent Calendar
@endsection
@section('admin-content')
{!! breadcrumbs([
'Admin Panel' => 'admin',
'Advent Calendars' => 'admin/data/advent-calendars',
($advent->id ? 'Edit' : 'Create') . ' Advent Calendar' => $advent->id ? 'admin/data/advent-calendars/edit/' . $advent->id : 'admin/data/advent-calendars/create',
]) !!}
{{ $advent->id ? 'Edit' : 'Create' }} Advent Calendar
@if ($advent->id)
Delete Advent Calendar
@endif
{!! Form::open(['url' => $advent->id ? 'admin/data/advent-calendars/edit/' . $advent->id : 'admin/data/advent-calendars/create']) !!}
Basic Information
{!! Form::label('Name') !!} {!! add_help('This is the name you will use to identify this advent calendar internally. This name will not be shown to users; a name that can be easily identified is recommended.') !!}
{!! Form::text('name', $advent->name, ['class' => 'form-control']) !!}
{!! Form::label('Display Name') !!} {!! add_help('This is the name that will be shown to users. This is for display purposes and can be something more vague than the above.') !!}
{!! Form::text('display_name', $advent->getRawOriginal('display_name'), ['class' => 'form-control']) !!}
{!! Form::label('Summary (Optional)') !!} {!! add_help('This is a short blurb that shows up when viewing an advent calendar\'s page. HTML cannot be used here.') !!}
{!! Form::text('summary', $advent->summary, ['class' => 'form-control', 'maxLength' => 250]) !!}
{!! Form::label('start_at', 'Start Time') !!} {!! add_help('Advent calendars cannot be viewed before the starting time, nor can prizes be claimed.') !!}
{!! Form::text('start_at', $advent->start_at, ['class' => 'form-control datepicker']) !!}
{!! Form::label('end_at', 'End Time') !!} {!! add_help('Advent calendars can be viewed after the ending time, but targets cannot be claimed.') !!}
{!! Form::text('end_at', $advent->end_at, ['class' => 'form-control datepicker']) !!}
@if ($advent->id)
With these start and end times, the advent calendar will run for {{ $advent->days }} days, with the first day on {{ $advent->start_at->toFormattedDateString() }} and last day on {{ $advent->end_at->endOf('day')->toFormattedDateString() }}.
While you do not need to set the start time to the beginning of the first day nor the end time to the end of the last day, you should give users enough time to claim these days' prizes, since they may not be available for the full 24 hours
that the other days' prizes are.
@endif
@if ($advent->id)
Bonus Prize
This prize, if an item is set, will be given to users who collect every prize from this advent. This is checked on the final day.
{!! Form::select('item_ids[bonus]', $items, isset($advent->data['bonus']) ? $advent->data['bonus']['item'] : null, ['class' => 'form-control mr-2 default item-select', 'placeholder' => 'Select Item']) !!}
{!! Form::text('quantities[bonus]', isset($advent->data['bonus']) ? $advent->data['bonus']['quantity'] : 1, ['class' => 'form-control mr-2', 'placeholder' => 'Quantity']) !!}
@endif
{!! Form::submit($advent->id ? 'Edit' : 'Create', ['class' => 'btn btn-primary']) !!}
{!! Form::close() !!}
@if ($advent->id)
Display Link
For convenience, here is the advent calendar's url as well as the full HTML to display a link to the advent calendar's user-facing page. Users claim the day's prize from this page.
{{ $advent->url }}
{{ $advent->displayLink }}
@endif
@if ($advent->id)
Log
This is the log of claimed prizes. Each claimed prize has its own row, since there can be any number of prizes per calendar.
{!! Form::open(['method' => 'GET', 'class' => 'form-inline justify-content-end']) !!}
{!! Form::select(
'sort',
[
'alpha' => 'Sort by User (A-Z)',
'alpha-reverse' => 'Sort by User (Z-A)',
'day' => 'Sort by Day (Asc)',
'day-reverse' => 'Sort by Day (Desc)',
'newest' => 'Newest First',
'oldest' => 'Oldest First',
],
Request::get('sort') ?: 'category',
['class' => 'form-control'],
) !!}
{!! Form::submit('Sort', ['class' => 'btn btn-primary']) !!}
{!! Form::close() !!}
@if (count($advent->participants))
{!! $participants->render() !!}
@foreach ($participants as $participant)
{!! $participant->user->displayName !!}
{{ $participant->day }} - {!! $advent->item($participant->day) ? $advent->item($participant->day)->displayName : 'Deleted Asset' !!} ×{{ $advent->itemQuantity($participant->day) }}
{!! pretty_date($participant->claimed_at) !!}
@endforeach
{!! $participants->render() !!}
@else
No participants found!
@endif
@endif
@endsection
@section('scripts')
@parent
@endsection