feat: added tpv app

This commit is contained in:
Pablo Moreno
2024-03-22 00:44:49 +01:00
parent a13eb6c9d9
commit b8562b3d7b
27 changed files with 1153 additions and 7 deletions
+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Pago de facturas</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {}
</script>
<style>
@layer utilities {
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
.top-bar {
background: linear-gradient(50deg, #02B0C4 0%, #A0D720 100%);
padding: 32px;
color: white;
display: flex;
justify-content: center;
}
</style>
</head>
<body>
{% include 'tpv/header.html' %}
{% block body %}
{% endblock %}
</body>
</html>
+15
View File
@@ -0,0 +1,15 @@
<div class="justify-between mb-6 rounded-lg bg-white p-6 shadow-md sm:flex sm:justify-start">
<div class="sm:ml-4 sm:flex sm:w-full sm:justify-between">
<div class="mt-5 sm:mt-0">
<h2 class="text-lg font-bold text-gray-900">Factura #{{ item.id }}</h2>
<p class="mt-1 text-xs text-gray-700">
{{ item.name }} - {{ item.description }}
</p>
</div>
<div class="mt-4 flex justify-between sm:space-y-6 sm:mt-0 sm:block sm:space-x-6">
<div class="flex items-center border-gray-100">
{{ item.amount_to_pay }} €
</div>
</div>
</div>
</div>
+3
View File
@@ -0,0 +1,3 @@
<header class="top-bar">
<img src="" alt="">
</header>
+102
View File
@@ -0,0 +1,102 @@
{% extends 'tpv/base.html' %}
{% block body %}
<div class="h-screen bg-gray-100 pt-10">
<header class="mb-10 text-center">
<h1 class="text-2xl font-bold p-4">Resumen de pedido</h1>
{% if order.status == 'PAI' %}
<span
class="bg-green-100 text-green-800 text-large font-large me-2 px-2.5 py-0.5 rounded-full dark:bg-green-400 dark:text-green-900">Pagado</span>
{% elif order.status == 'PEN' %}
<span
class="bg-yellow-100 text-yellow-800 text-large font-large me-2 px-2.5 py-0.5 rounded-full dark:bg-yellow-400 dark:text-yellow-900">Pendiente de pago</span>
{% else %}
<span
class="bg-red-100 text-red-800 text-large font-large me-2 px-2.5 py-0.5 rounded-full dark:bg-red-400 dark:text-red-900">Error de pago</span>
{% endif %}
</header>
<div class="mx-auto max-w-5xl justify-center px-6 md:flex md:space-x-6 xl:px-0">
<div class="rounded-lg md:w-2/3">
{% for item in order.metadata.items %}
{% include 'tpv/cart_item.html' %}
{% endfor %}
</div>
<div class=" md:w-1/3">
{% if order.status == 'PEN' %}
<!-- Formulario de email -->
<section class="mt-6 rounded-lg border bg-white shadow-md md:mt-0 mb-4">
<div class="flex flex-col items-center justify-center mx-auto">
<div
class="w-full rounded-lg md:mt-0 sm:max-w-md xl:p-0">
<div class="p-6 space-y-4 md:space-y-6 sm:p-8">
<form class="space-y-4 md:space-y-6" action="{{ action }}" method="POST">
{% csrf_token %}
{% for field in form %}
<label class="font-bold" for="{{ field.auto_id }}">{{ field.label }}</label>
{{ field }}
{% endfor %}
<button type="submit" class="mt-6 w-full rounded-md bg-blue-500 py-1.5 font-medium text-blue-50 hover:bg-blue-600 cursor-pointer">
Enviar
</button>
</form>
</div>
</div>
</div>
</section>
{% endif %}
<section class="mt-6 rounded-lg border bg-white p-6 shadow-md md:mt-0">
<div class="mb-2 flex justify-between">
<p class="text-gray-700">Subtotal</p>
<p class="text-gray-700">{{ order.amount }} €</p>
</div>
<hr class="my-4"/>
<div class="flex justify-between">
<p class="text-lg font-bold">Total</p>
<div class="">
<p class="mb-1 text-lg font-bold">{{ order.amount }} €</p>
<p class="text-sm text-gray-700">Impuestos incluidos</p>
</div>
</div>
{% if order.status == 'PEN' %}
<form name="from" action="{{ redsys_target_url }}" method="POST">
{% csrf_token %}
<input type="hidden" name="Ds_SignatureVersion" value="{{ signature_version }}"/>
<input type="hidden" name="Ds_MerchantParameters" value="{{ merchant_parameters }}"/>
<input type="hidden" name="Ds_Signature" value="{{ signature }}"/>
{% if order.contact_email != '' %}
<input
class="mt-6 w-full rounded-md bg-blue-500 py-1.5 font-medium text-blue-50 hover:bg-blue-600 cursor-pointer"
type="submit" value="Ir a pagar">
{% else %}
<input
class="mt-6 w-full rounded-md bg-blue-500 py-1.5 font-medium text-blue-50 hover:bg-blue-600 cursor-pointer"
type="submit" value="Ir a pagar" disabled>
{% endif %}
</form>
{% endif %}
</section>
</div>
</div>
</div>
{% endblock %}