@extends('app.my-account.admin.users.single')

@section('details')
    <h1>Related users </h1>
    <div>
        <table class="table table-sm table-striped">
            <thead>
            <tr>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Email</th>
                <th>Duplicate?</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            @foreach($relatedUsers as $relatedUser)
            <tr>
                <td>{{$relatedUser->name_first}}</td>
                <td>{{$relatedUser->name_last}}</td>
                <td>{{$relatedUser->email}}</td>
                <td>{{$relatedUser->is_marked_as_duplicate? 'Yes':'No'}}</td>
                <td>
                    <div>
                        <div moe normal>
                            <a start show href="#" class="text-primary">Merge into the verified account</a>
                            <form url="/api/customerStore/mergeUserAsAdmin">
                                @csrf
                                <input type="hidden" name="verifiedUserUid" value="{{ $user->uid }}">
                                <input type="hidden" name="unverifiedUserUid" value="{{ $relatedUser->uid }}">

                                <div>
                                    <button submit class="btn btn-sm btn-primary me-2">Merge</button>
                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </td>
            </tr>
            @endforeach
            </tbody>
        </table>
    </div>
@endsection
