@extends('layouts.appmin')

@section('tajuk')
Profil
@endsection

@section('breadcrumb')
    <ul class="breadcrumbs mb-3">
        <li class="nav-home">
            <a href="#">
            <i class="icon-home"></i>
            </a>
        </li>
        <li class="separator">
            <i class="icon-arrow-right"></i>
        </li>
        <li class="nav-item">
            <a href="#">Profil</a>
        </li>
    </ul>
@endsection

@section('content')
    
    @if (session('success'))
        <div class="alert alert-success mt-3" role="alert">
            {{ session('success') }}
        </div>
    @endif


    <div class="row">
			<div class="col-md-8 ">
        @include('profile.partials.update-profile-information-form')
            </div>
			<div class="col-md-4 ">
        @include('profile.partials.update-password-form')
            </div>
      <?php /*
        <div class="col-12">
                @include('profile.partials.delete-user-form')
        </div> */ ?>
    </div>

@endsection


@section('js')
<script>
    $(document).ready(function () {
        @if (session('status') === 'profile-updated')
            // Automatically hide the alert after 2 seconds
            setTimeout(function () {
                $('#alert-message').fadeOut('slow', function () {
                    $(this).alert('close'); // Closes the alert after fade out
                });
            }, 2000);
        @endif

        @if (session('status') === 'password-updated')
            // Automatically hide the alert after 2 seconds
            setTimeout(function () {
                $('#alert-message2').fadeOut('slow', function () {
                    $(this).alert('close'); // Closes the alert after fade out
                });
            }, 2000);
        @endif
        
        $('#deleteAccountButton').on('click', function () {
            $('#confirmUserDeletionModal').modal('show');
        });
    });
</script>
@endsection