@extends('layouts.site')
@section('meta_title', 'Edit Profile')
@section('content_header')
@include('partials._components._heading', ['heading' => 'Edit Profile'])
@endsection
@section('content')
<section class="site-main-section">
    <div class="site-container">
        <div class="account-shell mx-auto max-w-6xl">
            <div class="account-shell__aside min-w-0">
                @include('partials._components._user-menu')
            </div>

            <div class="account-shell__content min-w-0">
                <div class="profile-edit-card mt-4 mb-4">
                    <div class="profile-edit-card__header">
                        <div class="profile-edit-card__intro">
                            <h2 class="profile-edit-card__title">
                                {{ auth()->user()->fullName() }}
                                <span class="fa-regular fa-pen-to-square profile-edit-card__title-icon" aria-hidden="true"></span>
                            </h2>
                            <p class="profile-edit-card__subtitle">View and manage your profile information</p>
                        </div>
                        <div class="profile-edit-card__actions flex-row flex-nowrap items-center">
                            <a href="{{ route('participant.profile.show') }}" class="btn btn-sm btn-primary view-profile-button inline-flex items-center justify-center whitespace-nowrap">View Profile</a>
                            <a href="{{ route('participant.password.edit') }}" class="btn btn-sm btn-default change-password-button inline-flex items-center justify-center whitespace-nowrap">Change Password</a>
                        </div>
                    </div>
                    <div class="profile-edit-card__body">
                        @yield('content-main')
                        <div class="profile-edit-form-shell">
                            {!! form($form) !!}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
@endsection

@section('js')
@parent
@include('partials._participant.conditionals')
<script type="text/javascript">
    jQuery(function($) {
        $('#profile-form').find('select').each(function () {
            var $select = $(this);

            $select.attr('data-native-select', 'true');

            if ($select.hasClass('select2-hidden-accessible')) {
                $select.select2('destroy');
            }
        });

        var icons = {
            time: "fa-solid fa-clock",
            date: "fa-solid fa-calendar",
            up: "fa-solid fa-arrow-up",
            down: "fa-solid fa-arrow-down",
            previous: 'fa-solid fa-chevron-left',
            next: 'fa-solid fa-chevron-right',
            today: 'fa-solid fa-calendar-times',
            clear: 'fa-solid fa-trash',
            close: 'fa-solid fa-remove'
        };

        var $datetimepickers = $('.datetimepicker');
        $datetimepickers.length && $datetimepickers.datetimepicker({
            format: 'MM/DD/YYYY HH:mm:ss',
            icons: icons
        });

        var $datepickers = $('.datepicker');
        $datepickers.length && $datepickers.datetimepicker({
            format: 'MM/DD/YYYY',
            icons: icons
        });
    });
</script>
@endsection
