-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: No permitir crear clientes duplicados #88
- Loading branch information
1 parent
b7e1ae8
commit dd69ce6
Showing
3 changed files
with
163 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
from core.models import Persona | ||
|
||
|
||
def cliente_existe(dni_nuevo_cliente): | ||
cliente = Persona.objects.filter(documento = dni_nuevo_cliente) | ||
if cliente: | ||
return True | ||
return False |
172 changes: 148 additions & 24 deletions
172
venta/templates/venta/modals/modal_aniadir_cliente.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,151 @@ | ||
<div class="modal-xl modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel"> | ||
AÑADIR CLIENTE | ||
</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span>×</span> | ||
</button> | ||
</div> | ||
<form action="{% url 'venta:modalAniadirCliente' %}" method="POST"> | ||
<div class="modal-body"> | ||
{% csrf_token %} | ||
{{formulario.as_p}} | ||
|
||
{% load static %} | ||
|
||
<html> | ||
|
||
<head> | ||
<link rel="icon" type="image/png" href="/static/icons/hotelIco.png"> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<!--SWEET ALERT CSS--> | ||
<link rel="stylesheet" href="{% static '/css/sweetalert2.css' %}"> | ||
<!--BOOTSTRAP CSS--> | ||
<link rel="stylesheet" href="{% static '/css/bootstrap.min.css' %}"> | ||
|
||
<!-- Bootstrap CSS para datatable--> | ||
<link rel="stylesheet" href="{% static '/css/bootstrap.css' %}"> | ||
<link rel="stylesheet" href="{% static '/css/dataTables.bootstrap4.min.css' %}"> | ||
<!-- Bootstrap CSS para datatable--> | ||
|
||
<!-- FONTAWESOME --> | ||
<script src="{% static '/js/d91d4c71ff.js' %}"></script> | ||
|
||
<!--CUSTOM CSS--> | ||
<link rel="stylesheet" href="{% static '/css/styleBase.css' %}"> | ||
<link rel="stylesheet" href="{% static '/css/modal.css' %}"> | ||
<link rel="stylesheet" href="{% static '/css/botones.css' %}"> | ||
|
||
|
||
{% block extra_css %} | ||
|
||
{% endblock extra_css %} | ||
</head> | ||
|
||
<body class="bodyComplete"> | ||
|
||
|
||
<!-- HEADER --> | ||
<div class="container-fluid mainHeader p-3 fixed-top"> | ||
<div class="row"> | ||
<div class="col-2"> | ||
{% block header %} | ||
|
||
{% endblock header %} | ||
|
||
</div> | ||
<div class="col-8"> | ||
{% block headerContenido %} | ||
{% endblock headerContenido %} | ||
|
||
{% block carrito %} | ||
{% endblock carrito %} | ||
</div> | ||
<div class="col-2"> | ||
|
||
<button onclick="location.href='/core/logout'" style="text-decoration:none; align-items:right;" | ||
class="rounded-1 btn btn-lg btn-outline-secondary text-white float-center mt-1 "> Cerrar Sesion | ||
</button> | ||
|
||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="dismiss" class="cerrar" data-dismiss="modal"> | ||
Cerrar | ||
</button> | ||
<button type="submit" name="accion" class="guardar" value="hotel"> | ||
Guardar | ||
</button> | ||
</div> | ||
|
||
<!-- opciones + contenido --> | ||
<div class="container-fluid position-fixed" style="top: 100px;"> | ||
<!-- CONTENIDO --> | ||
<div class="col-12 position-relative" id="main"> | ||
|
||
<div class="modal-xl modal-dialog modal-dialog-scrollable"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel"> | ||
AÑADIR CLIENTE | ||
</h5> | ||
<a type="button" class="close" data-dismiss="modal" aria-label="Close" href="{% url 'venta:vistaCliente' %}"> | ||
<span aria-hidden="true">×</span> | ||
</a> | ||
</div> | ||
<form action="{% url 'venta:modalAniadirCliente' %}" method="POST"> | ||
<div class="modal-body"> | ||
{% csrf_token %} | ||
{{formulario.as_p}} | ||
</div> | ||
<div class="modal-footer"> | ||
<a href="{% url 'venta:vistaCliente' %}">Cerrar</a> | ||
<button type="submit" name="accion" class="guardar" value="hotel"> | ||
Guardar | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
|
||
<!-- Footer --> | ||
<div class="footer text-center mb-0 fixed-bottom"> | ||
<div class="container"> | ||
{% block footer %} | ||
|
||
{% endblock footer %} | ||
<p class="m-0 mbt1 text-white">© UNPSJB - GRUPO 1 - DESARROLLO DE SOFTWARE</p> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<!--sweet alert2--> | ||
|
||
<script src="{% static '/js/[email protected]' %}"></script> | ||
|
||
<!-- Bootstrap 4.5--> | ||
<script src="{% static '/js/jquery-3.5.1.js' %}"></script> | ||
<script src="{% static '/js/bootstrap.bundle.js' %}"></script> | ||
|
||
<script src="{% static '/js/bootstrap-datetimepicker.min.js' %}"></script> | ||
|
||
<!--dataTable jquery + bootstrap + popper include--> | ||
<script src="{% static 'js/jquery.dataTables.min.js'%}"></script> | ||
<script src="{% static '/js/dataTables.bootstrap4.min.js'%}"></script> | ||
|
||
<!--scripts personalizados--> | ||
<script src="{% static '/js/main.js' %}"></script> | ||
|
||
<!--sweet alert2--> | ||
<script src="{% static '/js/[email protected]' %}"></script> | ||
|
||
|
||
|
||
<!--dataTable jquery + bootstrap + popper include--> | ||
<script src="{% static '/js/jquery.dataTables.min.js'%}"></script> | ||
<script src="{% static '/js/dataTables.bootstrap4.min.js'%}"></script> | ||
|
||
|
||
<!--scripts personalizados--> | ||
|
||
<script src="{% static '/js/main.js' %}"></script> | ||
|
||
<!--CUSTOM CSS--> | ||
<link rel="stylesheet" href="{% static '/css/styleBase.css' %}"> | ||
<link rel="stylesheet" href="{% static '/css/modal.css' %}"> | ||
<link rel="stylesheet" href="{% static '/css/botones.css' %}"> | ||
|
||
{% block extrajs %} | ||
{% endblock %} | ||
|
||
</body> | ||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters