<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>TESTE ORANGE B2W</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">


    <style>

        body {
  background: #f7f7f7;
}

.form-box {
  max-width: 500px;
  margin: auto;
  padding: 50px;
  background: #ffffff;
  border: 10px solid #f2f2f2;
}

h1, p {
  text-align: center;
}

input, textarea {
  width: 100%;
}
    </style>
</head>
<body>
    <div class="col-12" >
        <div class="row" style="display: flex;margin-left:80px">
            <div class="col-3"><a href="{{asset('checkidlestatus')}}" class="btn btn-primary">Idle Status Check (Using the /idle endpoint)</a></div>
            <div class="col-3"><a href="{{asset('get_balance_form')}}" class="btn btn-primary">GetAccountBalance Request</a></div>
            <div class="col-3"><a href="{{asset('checkidlestatus')}}" class="btn btn-primary">Wallet to bank transfert teste</a></div>
            <div class="col-3"><a href="{{asset('checkidlestatus')}}" class="btn btn-primary">TransferStatusInquiry</a></div>
          </div>
      </div>


    <div class="form-box">
        <h1>Souscription d'un client Orange B2W</h1>
        <p>L'utilisateur entre ses informations (nom, prénom, téléphone).</p>
           <p>Le service envoie ces informations via une requête POST à l'URL de la sandbox pour inscrire le client.</p>
            <p>En cas de succès, un message de confirmation est renvoyé, sinon un message d'erreur.</p>
        <form action="" method="post" id="myform" >

          <div class="form-group">
            <label for="email">Alias</label>
            <input class="form-control" id="alias" type="text" name="alias">
          </div>
          <button onclick="onsubmitform()" type="button" class="btn btn-primary">Valider</button>
        </form>
      </div>



      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
      <script>
        function onsubmitform(){

            var alias = $("#alias").val();

            //Ajax
            $.ajax({
                url: "{{asset('register')}}",
                method: "POST",
                data:{alias:alias,_token: '{{ csrf_token() }}'},
                success: function(response) {
                    console.log(response);
                    alert('Souscription réussie!');
                },
                error: function(error) {
                    console.log(error);
                    alert('Erreur lors de la souscription!');
                }
            });

            // Reset du formulaire
            $('#myform').trigger("reset");
        }
      </script>

</body>
</html>
