@extends('adminlte::page')

@section('title', config('app.name') . ' | ' . __('Account age update'))

@section('content_header')
    <h1>{{__('My account')}} / {{__('Apply')}} / {{__('Account age update')}}</h1>
@stop

@section('js')

    @if (session()->has('success'))

        <script>
            toastr.success("{{session('success')}}")
        </script>

    @elseif(session()->has('error'))

        <script>
            toastr.error("{{session('error')}}")
        </script>

    @endif

    @if(!$isEligibleForApplication)

        <script>toastr.error("{{__('Application access denied')}}")</script>

    @endif

    <script>
        flatpickr('#dob', {
            altInput: true,
            altFormat: "F j, Y",
            dateFormat: "Y-m-d",
        });
    </script>

@stop

@section('content')


    <div class="row">
        <div class="col">
            <x-alert title="{{ __('Date of birth required to continue') }}" alert-type="warning" icon="fa fa-exclamation-triangle">
                {{ __('Because you signed up using Discord, your age was not registered in our system. In order to continue applying for this position, please add your date of birth below. Please note that we don\'t accept registrations from users under 13 years of age.') }}
            </x-alert>

            <x-alert title="{{ __('Warning') }}" alert-type="danger" icon="fas fa-user-lock">
                {{ __('You can\'t change your date of birth after first setting it.') }}
            </x-alert>
        </div>
    </div>

    <div class="row">



        <div class="col-md-6 offset-md-3">
            <x-card id="updateAge" card-title="Account age update" footer-style="">

                <x-slot:cardHeader></x-slot:cardHeader>

                <form id="addDob" method="post" action="{{ route('add-dob') }}">
                    @csrf
                    @method('PATCH')
                    <div class="form-group mb-4 mt-2">
                        <label for="dob" class="sr-only">{{__('Date of birth')}}</label>
                        <input type="text" class="form-control" name="dob" id="dob" placeholder="Date of birth">
                        <span class="text-muted text-sm"><i class="fas fa-info-circle"></i> {!! __("<b>Why do we need this?</b> We use your age information to make sure you meet age requirements for certain positions, and to make sure that everyone is compliant with our terms of service.") !!} </span>
                    </div>


                </form>

                <x-slot:cardFooter>
                    <button onclick="$('#addDob').submit()" type="button" class="btn btn-success"><i class="fas fa-save"></i> {{ __('Save and continue') }}</button>
                </x-slot:cardFooter>
            </x-card>



        </div>
    </div>


@stop

@section('footer')
    @include('breadcrumbs.dashboard.footer')
@stop
