-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from Troter2/294-crear-llistat-de-ofertes-per…
…-administrador 294 crear llistat de ofertes per administrador
- Loading branch information
Showing
6 changed files
with
278 additions
and
32 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
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
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
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
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,134 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
{% block title %} Promociones del Hotel {% endblock %} | ||
{% block content %} | ||
<h1 class="mx-3 my-3">Lista de Cupones del Hotel</h1> | ||
<div class="container-fluid"> | ||
<div class="row mt-3"> | ||
<div class="col"> | ||
<button type="button" data-bs-toggle="modal" data-bs-target="#create-coupon" class="btn btn-primary"> | ||
Crear Cupon | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="promotions-list mt-3"> | ||
<div class="container-fluid"> | ||
<table class="table table-striped table-dark col-sm-11"> | ||
<thead class="thead-dark"> | ||
<tr> | ||
<th scope="col">Codigo de descuento</th> | ||
<th scope="col">Porcentage de descuento</th> | ||
<th scope="col">Estado</th> | ||
<th scope="col"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for cupon in cupones %} | ||
<tr> | ||
<td>{{ cupon.discount_code }}</td> | ||
<td>{{ cupon.discount_percentage }}</td> | ||
{% if cupon.active == True %} | ||
<td> | ||
<form method="post" action="{% url 'edit_status_coupon' %}"> | ||
{% csrf_token %} | ||
<input type="hidden" name="id_coupon" value="{{ cupon.pk }}"> | ||
<button type="submit" class="btn btn-success">Activo</button> | ||
</form> | ||
</td> | ||
{% else %} | ||
<td> | ||
<form method="post" action="{% url 'edit_status_coupon' %}"> | ||
{% csrf_token %} | ||
<input type="hidden" name="id_coupon" value="{{ cupon.pk }}"> | ||
<button type="submit" class="btn btn-danger">Inactivo</button> | ||
</form> | ||
</td> | ||
{% endif %} | ||
<td> | ||
<button type="button" class="btn btn-success" data-bs-toggle="modal" | ||
data-bs-target="#Pop-up-edit-{{ cupon.id }}"> | ||
Editar Cupon | ||
</button> | ||
</td> | ||
</tr> | ||
|
||
<!-- Modales de editar cupon --> | ||
<div class="modal fade" id="Pop-up-edit-{{ cupon.id }}" tabindex="-1" role="dialog" | ||
aria-labelledby="ModalLabel" aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel"> | ||
Editar cupon Nº{{ cupon.id }} | ||
</h5> | ||
<button type="button" class="btn-close" data-bs-dismiss="modal" | ||
aria-label="Close"></button> | ||
</div> | ||
<form action="{% url 'edit_coupon' %}" method="post"> | ||
{% csrf_token %} | ||
<div class="modal-body d-flex row "> | ||
<input type="hidden" name="id" value="{{ cupon.pk }}"> | ||
<div class="col-6"> | ||
<div class="col-12"> | ||
<p><strong>Codigo de descuento:</strong></p> | ||
<input type="text" class="form-control" id="discount_code" | ||
value="{{ cupon.discount_code }}" name="discount_code"> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<div class="col-12"> | ||
<p><strong>Porcentage de descuento:</strong></p> | ||
<input type="number" max="100" min="0" class="form-control" | ||
id="discount_percentage" value="{{ cupon.discount_percentage }}" | ||
name="discount_percentage"> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="submit" class="btn btn-primary"> | ||
Guardar | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% endfor %} | ||
|
||
<!-- Modal para crear un cupon --> | ||
<div class="modal fade" id="create-coupon" tabindex="-1" role="dialog" | ||
aria-labelledby="ModalLabel" aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="exampleModalLabel"> | ||
Crear cupon | ||
</h5> | ||
<button type="button" class="btn-close" data-bs-dismiss="modal" | ||
aria-label="Close"></button> | ||
</div> | ||
<form method="POST" action="{% url 'create_coupon' %}"> | ||
<div class="modal-body"> | ||
{% csrf_token %} | ||
<p><strong>Codigo:</strong></p> | ||
<input type="text" class="form-control" id="discount_code" name="discount_code"> | ||
<p><strong>Porcentage de descuento:</strong></p> | ||
<input type="number" max="100" min="0" class="form-control" id="discount_percentage" | ||
name="discount_percentage"> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="submit" class="btn btn-success">Crear</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
{% endblock %} |
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