forked from jcgeneration/CH37_ListaCompras
-
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.
- Loading branch information
1 parent
57e9e13
commit 235eb83
Showing
4 changed files
with
200 additions
and
2 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 |
---|---|---|
@@ -1,2 +1,31 @@ | ||
# CH37_ListaCompras | ||
Lista de Compras | ||
# Lista de Compras | ||
Se muestra una página que permite crear una lista de compras de forma dinámica usando HTML y Javascript | ||
|
||
El archivo index.html muestra una plantilla para comenzar con la programación de dicha funcionalidad como se muestra a continuación: | ||
|
||
![Image](https://github.com/jcgeneration/CH37_ListaCompras/blob/main/img/SplashScreen.png) | ||
|
||
> Los archivos se proporcionan con fines didácticos | ||
--- | ||
Los objetivos son: | ||
1. Agregar elementos en una tabla | ||
2. Validar la información de los campos | ||
3. Crear un precio por producto al azar | ||
4. Realizar las operaciones para conocer el total de elementos | ||
5. Realizar las operaciones para conocer el total en costo | ||
6. Almacenar la información en el almacenamiento local del navegador | ||
7. Mostrar la información almacenada cuando se abra la página | ||
|
||
|
||
--- | ||
|
||
*Se utiliza una plantilla de Bootstrap* | ||
|
||
*Existe un archivo js/main.js vinculado donde se debe agregar el código para manipular el DOM* | ||
|
||
|
||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,168 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="description" content=""> | ||
<title>Lista de Compras</title> | ||
<link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/checkout/"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | ||
|
||
<!-- Favicons --> | ||
<link rel="apple-touch-icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/apple-touch-icon.png" sizes="180x180"> | ||
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png"> | ||
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png"> | ||
<link rel="mask-icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/safari-pinned-tab.svg" color="#712cf9"> | ||
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon.ico"> | ||
<meta name="theme-color" content="#712cf9"> | ||
<style> | ||
.bd-placeholder-img { | ||
font-size: 1.125rem; | ||
text-anchor: middle; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
@media (min-width: 768px) { | ||
.bd-placeholder-img-lg { | ||
font-size: 3.5rem; | ||
} | ||
} | ||
|
||
.b-example-divider { | ||
height: 3rem; | ||
background-color: rgba(0, 0, 0, .1); | ||
border: solid rgba(0, 0, 0, .15); | ||
border-width: 1px 0; | ||
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15); | ||
} | ||
|
||
.b-example-vr { | ||
flex-shrink: 0; | ||
width: 1.5rem; | ||
height: 100vh; | ||
} | ||
|
||
.bi { | ||
vertical-align: -.125em; | ||
fill: currentColor; | ||
} | ||
|
||
.nav-scroller { | ||
position: relative; | ||
z-index: 2; | ||
height: 2.75rem; | ||
overflow-y: hidden; | ||
} | ||
|
||
.nav-scroller .nav { | ||
display: flex; | ||
flex-wrap: nowrap; | ||
padding-bottom: 1rem; | ||
margin-top: -1px; | ||
overflow-x: auto; | ||
text-align: center; | ||
white-space: nowrap; | ||
-webkit-overflow-scrolling: touch; | ||
} | ||
</style> | ||
|
||
|
||
<!-- Custom styles for this template --> | ||
<link href="https://getbootstrap.com/docs/5.2/examples/checkout/form-validation.css" rel="stylesheet"> | ||
</head> | ||
<body class="bg-light"> | ||
|
||
<div class="container"> | ||
<main> | ||
<div class="py-5 text-center"> | ||
<img class="d-block mx-auto mb-4" src="https://getbootstrap.com/docs/5.2/assets/brand/bootstrap-logo.svg" alt="" width="72" height="57"> | ||
<h2>Lista de Compras</h2> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-4 order-md-2 mb-4"> | ||
<h4 class="d-flex justify-content-between align-items-center mb-3"> | ||
<span class="text-muted">Resumen</span> | ||
<span class="badge rounded-pill text-bg-danger" id="contadorProductos">0</span> | ||
</h4> | ||
<ul class="list-group mb-3"> | ||
<li class="list-group-item d-flex justify-content-between lh-condensed"> | ||
<div> | ||
<h5 class="my-0" id="totalProductos">Total en Productos</h5> | ||
</div> | ||
<span class="text-muted" id="productosTotal">0</span> | ||
</li> | ||
<li class="list-group-item d-flex justify-content-between lh-condensed"> | ||
<div> | ||
<h5 class="my-0" id="totalPrecio">Total</h5> | ||
</div> | ||
<span class="text-muted" id="precioTotal">$0</span> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="col-md-8 order-md-1"> | ||
<h4 class="mb-3">Agregar Productos</h4> | ||
<div class="alert alert-danger fade show" style="display:none;" | ||
role="alert" id="alertValidaciones"> | ||
<p id="alertValidacionesTexto"></p> | ||
</div> | ||
<form class="needs-validation" novalidate> | ||
<div class="row"> | ||
<div class="col-md-6 mb-3"> | ||
<label for="Name">Nombre</label> | ||
<input type="text" class="form-control" id="Name" placeholder="" value="" autocomplete="off" required> | ||
<div class="invalid-feedback"> | ||
Nombre inválido | ||
</div> | ||
</div> | ||
<div class="col-md-6 mb-3"> | ||
<label for="Number">Cantidad</label> | ||
<input type="text" class="form-control" id="Number" placeholder="" value="" autocomplete="off" required> | ||
<div class="invalid-feedback"> | ||
Cantidad inválida | ||
</div> | ||
</div> | ||
</div> | ||
<button id="btnAgregar" class="btn btn-primary btn-lg btn-block" type="button">Agregar</button> | ||
<button id="btnClear" class="btn btn-primary btn-lg btn-block" type="button">Limpiar todo</button> | ||
<hr class="mb-4"> | ||
|
||
<!-- La tabla está aquí --> | ||
<table class="table" id="tablaListaCompras"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Nombre</th> | ||
<th scope="col">Cantidad</th> | ||
<th scope="col">Precio</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
</tbody> | ||
</table> | ||
|
||
</form> | ||
</div> | ||
</div> | ||
|
||
<footer class="my-5 pt-5 text-muted text-center text-small"> | ||
<p class="mb-1">© 2024 JC Inc.</p> | ||
<ul class="list-inline"> | ||
<li class="list-inline-item"><a href="#">Privacy</a></li> | ||
<li class="list-inline-item"><a href="#">Terms</a></li> | ||
<li class="list-inline-item"><a href="#">Support</a></li> | ||
</ul> | ||
</footer> | ||
</div> | ||
|
||
<script src="js/main.js"></script> | ||
|
||
|
||
<script src="https://getbootstrap.com/docs/5.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | ||
|
||
<script src="https://getbootstrap.com/docs/5.2/examples/checkout/form-validation.js"></script> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// El código va aquí -> |