{{define "beneficiary_wallet"}}
<div class="px-4 py-6 sm:px-6 text-center"
  x-data="{
    walletdialog: false
  }">
  <div class="px-4 py-5 sm:px-6">
    <p class="text-center text-lg">Solde : {{if .ViewState.beneficiary.Data.wallet}}{{ printf "%.2f" .ViewState.beneficiary.Data.wallet }}{{else}}0{{end}} €</p>
  <button  @click="walletdialog = !walletdialog" 
    class="rounded-2xl border border-transparent bg-co-blue px-4 py-2 my-4 mt-8 w-full text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:w-auto">
    Créditer le compte
  </button>
  <div class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true"
       x-show="walletdialog">
    <div class="fixed inset-0 bg-gray-900 opacity-30 transition-opacity"></div>
                                
    <div class="fixed inset-0 z-10 overflow-y-auto">
      <div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
        <div class="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6">
          <div>
            <div class="mt-3 text-center sm:mt-5">
              <h3 class="text-lg font-medium leading-6 text-gray-900" id="modal-title">Créditer le compte</h3>
                <div class="mt-2">
                  <p class="text-sm text-gray-500">Créditer le compte mobilité de l'utilisateur</p>
                </div>
              </div>
            </div>
          <form method="POST" action="/app/wallets/{{.ViewState.beneficiary.ID}}/credit" class="my-4">
              <div class="my-8">
                <input type="number" step="0.01" id="amount" name="amount" value="0"
                       class="w-full shadow-sm focus:ring-co-blue focus:border-co-blue px-2 p-1 sm:text-sm border-gray-300 rounded-2xl">
              </div>
              <div class="mt-5 sm:mt-6">
                <button type="submit" class="inline-flex w-full justify-center rounded-2xl border border-transparent bg-co-blue px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:text-sm">Ajouter</button>
              </div>
              <div class="mt-5 sm:mt-6">
                <button @click="walletdialog=false" type="button" class="inline-flex w-full justify-center max-w-xs bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>

</div>
{{end}}
