@extends('layouts.app')
@section('title','User Profile | ')
@section('content')

<!-- Start Default Modal  -->

<div class="modal fade" id="modal-default">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Change Profile Image</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form id="update_profile_image_form" method="post">
                    <div class="row">
                        <div class="col-md-8 offset-md-2">
                            <div class="form-group">
                                <label for="profileImage">Choose Profile Image</label>
                                <input type="file" name="profile_image" id="profileImage"
                                    class="form-control">
                                <small class="text-danger profile_err"></small>
                            </div>
                        </div>
                        <div class="col-md-8 offset-md-2">
                            <button type="button" id="update_profile_image_btn" class="btn btn-primary w-100">Update Profile</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!-- End Default Modal -->

<!-- Content Header (Page header) -->
<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0">User Profile</h1>
            </div><!-- /.col -->
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                    <li class="breadcrumb-item active">Profile</li>
                </ol>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <!-- Profile Image -->
                <div class="card card-primary card-outline">
                    <div class="card-body box-profile">
                        <div class="text-center">
                            @if(!empty($user_info->user_profile))
                            <img class="profile-user-img img-fluid img-circle" src='{{ asset("public/assets/users/profiles/$user_info->user_profile") }}'' alt="User profile picture">
                            @else 
                                <i class="fas fa-user fa-2x p-3 border border-secondary rounded-circle text-secondary"></i>
                            @endif
                        </div>
                        <div class="text-center">
                            <a href="#" class="text-primary" data-toggle="modal"
                                data-target="#modal-default"><small>Change Profile</small></a>
                        </div>
                        <h3 class="profile-username text-center">{{ $user_info->full_name }}</h3>
                        <p class="text-muted text-center">{{ getUserType($user_info->type) }}</p>
                        <a href="{{ route('edit.profile', $user_info->id) }}"
                            class="btn btn-primary btn-block"><b>Edit Profile</b></a>
                        <a href="{{ route('user.change.password', $user_info->id) }}" 
                            class="btn btn-warning btn-block"><b>Change Password</b></a>
                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
            <!-- /.col -->
            <div class="col-md-9">
                <div class="card">
                    <div class="card-header p-2">
                        <h4 class="card-title font-weight-bold">Personal Info</h4>
                    </div>
                    <!-- /.card-header -->
                    <div class="card-body">
                        @if(session('success'))
                        <div class="alert alert-success alert-dismissible fade show" role="alert">
                            <strong>{{ session('success') }}</strong>
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        @endif
                        @if(session('error'))
                        <div class="alert alert-danger alert-dismissible fade show" role="alert">
                            <strong>{{ session('success') }}</strong>
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        @endif
                        @if(session('warning'))
                        <div class="alert alert-warning alert-dismissible fade show" role="alert">
                            <strong>{{ session('warning') }}</strong>
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        @endif
                        <div class="p-1">
                            <p>
                                <strong>
                                    Full Name: <span>{{ $user_info->full_name }}
                                </strong>
                            </p>
                           
                            <p>
                                <strong>
                                    Mobile : <span>{{ $user_info->mobile_number }}
                                </strong>
                            </p>
                            <p>
                                <strong>
                                    Email : <span>{{ $user_info->email }}
                                </strong>
                            </p>
                            <p>
                                <strong>
                                    User Role : <span>{{ getUserType($user_info->user_role)  }}
                                </strong>
                            </p>
                            <p>
                                <strong>
                                    District : <span>{{ $user_info->district_name  }}
                                </strong>
                            </p>
                        </div>
                    </div><!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->

    </div>
    <!--/. container-fluid -->
</section>
<!-- /.content -->

@stop
