<%- include('../partials/head.ejs') %>
    <!--
`body` tag options:

  Apply one or more of the following classes to to the body tag
  to get the desired effect

  * sidebar-collapse
  * sidebar-mini
-->

    <body class="hold-transition sidebar-mini">
        <div class="wrapper">
            <!-- Navbar -->
            <%- include('../partials/navigation.ejs') %>
                <!-- /.navbar -->

                <!-- Main Sidebar Container -->

                <%- include('../partials/sidebar.ejs') %>

                    <!-- Content Wrapper. Contains page content -->
                    <div class="content-wrapper">
                        <!-- 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">Manage User</h1>
                                    </div><!-- /.col -->
                                    <div class="col-sm-6">
                                        <ol class="breadcrumb float-sm-right">
                                            <li class="breadcrumb-item"><a href="/admin">Home</a></li>
                                            <li class="breadcrumb-item"><a href="/admin/users">Manage User</a></li>
                                            <li class="breadcrumb-item active">View</li>
                                        </ol>
                                    </div><!-- /.col -->
                                </div><!-- /.row -->
                            </div><!-- /.container-fluid -->
                        </div>
                        <!-- /.content-header -->

                        <!-- Main content -->
                        <div class="content">
                            <div class="container-fluid">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <form name="edit_customer" method="POST">
                                            <div class="card">
                                                <div class="card-header">
                                                    <h3 class="card-title">View User</h3>
                                                </div>
                                                <div class="card-body row">
                                                    <div class="col-md-6">
                                                        <div class="form-group">
                                                            <label for="first_name">Name</label>
                                                            <input readonly type="text" class="form-control" name="first_name" 
                                                                value="<%= data.name %>"
                                                                id="first_name" />
                                                        </div>
                                                        
                                                        
                                                    </div>
                                                    <div class="col-md-6">
                                                        <div class="form-group">
                                                            <label for="email">Email</label>
                                                            <input readonly type="email" class="form-control" name="email" 
                                                                value="<%= data.email %>"
                                                                id="email" />
                                                        </div>
                                                    </div>
                                                    <% if(data.two_factor == 1) { %>
                                                        <div class="col-md-6">
                                                            <div class="form-group">
                                                                <label for="phone_no">Phone No.</label>
                                                                <input readonly type="tel" class="form-control" name="phone_no" 
                                                                value="<%= data.phone %>"
                                                                    id="phone_no" />
                                                            </div>
                                                        </div>
                                                    <% }else{ }%>
                                                    <% if(data.UserTokens !== null && typeof data.UserTokens !== 'undefined' && data.UserTokens.length > 0) { %>
                                                        <% data.UserTokens.forEach((tok, index)=> {   %>
                                                            <div class="form-group col-md-6">
                                                                <label for="Earned">Total Earned</label>
                                                                <input readonly type="text" class="form-control" name="Earned" 
                                                                value="<%= tok.total_earned %>"
                                                                    id="Earned" />
                                                            </div>
                                                            <div class="form-group col-md-6">
                                                                <label for="currentBalance">Current Balance</label>
                                                                <input readonly type="text" class="form-control" name="currentBalance" value="<%= tok.current_balance %>" id="currentBalance" />
                                                            </div>
                                                        <% }) %>
                                                    <% }else{ %>
                                                        <div class="form-group col-md-6">
                                                            <label for="Earned">Total Earned</label>
                                                            <input readonly type="text" class="form-control" name="Earned" 
                                                            value="0" id="Earned" />
                                                        </div>
                                                        <div class="form-group col-md-6">
                                                            <label for="currentBalance">currentBalance</label>
                                                            <input readonly type="text" class="form-control" name="currentBalance" value="0" id="currentBalance" />
                                                        </div>
                                                    <% } %>
                                                </div>
                                                
                                                <div class="card-footer">
                                                    <a href="/admin/users" class="ml-2 btn btn-warning">Back</a>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <!-- /.col-md-6 -->
                                </div>
                                <!-- /.row -->
                            </div>
                            <!-- /.container-fluid -->
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.content-wrapper -->

                    <!-- Control Sidebar -->
                    <aside class="control-sidebar control-sidebar-dark">
                        <!-- Control sidebar content goes here -->
                    </aside>
                    <!-- /.control-sidebar -->

                    <!-- Main Footer -->

        </div>
        <!-- ./wrapper -->

        <!-- REQUIRED SCRIPTS -->

        <!-- jQuery -->

        <%- include('../partials/scripts.ejs') %>

    </body>