@extends('EcomAuthViews::layouts.authentication.layout')

@php
    $type = "phone";
@endphp

@section('content')
    <form class="twa-form" method="POST" action="{{route('account-login-post')}}">
        @csrf

        @if($type == 'phone')


        <input type="hidden" name="type" value="phone">
        @component('EcomGeneralViews::components.form.input', [ "parentClass" => "", "size" => "full", "type" => "text", "label" => ___('authentication.phone_number') ])
            <input class="phone-field" required
                   data-custom-container="" data-allow-dropdown="true"
                   data-autohide-dialcode="true" data-format="true" data-national-mode="false" placeholder=" "
                   name="phone" data-initial-country="{{$country_code}}"

                   @if(isset($phone_value) && $phone_value != '') value="{{$phone_value}}" @else  value="" @endif
            />
            <input type="hidden" name="phone_country_code" class="phone_country_code" value=""/>
        @endcomponent

        @else

        @endif
        @component('EcomGeneralViews::components.form.input', [ "parentClass" => "", "size" => "full", "type" => "submit", "label" => "" ])
            <input type="submit" value="{{ ___('authentication.continue') }}"/>
        @endcomponent
    </form>

    @if(isset($config['providers']['facebook']))
        <a href="#" class="icon-button">
            <div class="icon">@include('EcomGeneralViews::icons.facebook') </div>
            <div class="text">Continue with Facebook</div>
            <div class="icon"></div>
        </a>
    @endif
    @if(isset($config['providers']['google']))
        <a href="#" class="icon-button">
            <div class="icon">@include('EcomGeneralViews::icons.google')</div>
            <div class="text">Continue with Google</div>
            <div class="icon"></div>
        </a>
    @endif
    @if(isset($config['providers']['apple']))
        <a href="#" class="icon-button">
            <div class="icon">@include('EcomGeneralViews::icons.google')</div>
            <div class="text">Continue with Apple</div>
            <div class="icon"></div>
        </a>
    @endif

{{--    @if($type == 'phone')--}}


    @if(in_array('email',$config['auth_types']))
        <a href="{{url()->current().'?type=email'}}" class="icon-button">
            <div class="icon">@include('EcomGeneralViews::icons.email')</div>
            <div class="text">Continue with Email</div>
            <div class="icon"></div>
        </a>
    @endif

@endsection
@section('scripts')
    <script>
        $(document).ready(function () {
            AUTHENTICATION_InitCodeGroup('code-input-group');
        });
    </script>
@endsection
