Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EXQLVR06 committed Dec 11, 2022
0 parents commit edbc2c5
Show file tree
Hide file tree
Showing 64 changed files with 1,824 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/AluraGeek-Grupo3.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Alura Challenge | Oracle One | Front-end | AluraGeek Latam
---
<p align="center" >
<img width="800" heigth="400" src="https://user-images.githubusercontent.com/91544872/153603780-b5e5b462-893b-471c-9b7f-7f57ad2aaff3.png">
</p>

### En este repositório se encuentra el código que realizamos en nuestro Live Coding del dia 21/04/2022
### Nuestro obejtivo era la contrucción de nuestra página principal de manera estática por lo que hasta el momento no implementamos ninguna funcionalidad con JavaScript.

## ¿Qué encontrarás?

#### En este repositorio actualizado encontrarás 3 ramas, cada una de las cuales contiene una versión actualizada del código. Siendo Live parte I, Live parte II y Full Crud. Al hacer clic en cada uno de ellos, obtendrá una versión actualizada del repositorio y podrá navegar entre los archivos.

<p align="center" >
<img width="300" heigth="400" src="https://user-images.githubusercontent.com/101413385/203182662-94c38802-9506-46f1-8a7a-292ef40aae4c.png">
</p>


1) Carpeta assets con todas las imagenes utilizadas en nuestra página principal
2) Archivo index.html donde encontrarás el código HTML referente a la página principal de nuestro AluraGeek
3) Archivo login.html donde encontrarás el código HTML referente a la página de iniciar sesión
4) Archivo reset.css utilizado para quitar todas los estilos predeterminados
5) Archivo style.css donde están todas las clases CSS utiilizadas en la personalización de nuestra barra principal y nuestro banner
6) Archivo productos.css donde están todas las clases CSS utiilizadas en la personalización de nuestras secciones de productos
7) Archivo style-login.css donde están todas las clases CSS utiilizadas en la personalización de la sección de login.
8) Views, donde se almacena el HTML de toda la aplicación.
9) Controllers, donde se encuentra la lógica de manipulación de los protocolos CRUD.
10) Servicios donde se encuentra la lógica de las peticiones CRUD como: Get, Post, Update y Delete.

Es importante que recordemos que este código lo construimos juntos en nuestro live coding y que aún pueden faltar algunos estilos y elementos por aplicar.
Como lo dijimos en la live también dejamos para ustedes una versión responsiva solo para mobile, ahora queda en sus manos terminar el desarrollo de nuestro e-commerce.

Si te perdiste el Live no te preocupes puedes acceder a través del link [Live Coding AluraGeek](https://www.youtube.com/watch?v=fAkdeHeIB7U)


Si tienes alguna pregunta puedes realizarla a través del canal de dudas del Challenge en la categoría Front End o inclusive unirte con tus colegas en las salas de estudio para encontrar nuevas soluciones.

<p align="center" >
<img width="300" heigth="400" src="https://user-images.githubusercontent.com/101413385/164736272-0e50eea3-9196-4af5-96fe-700eae2b5a81.png">
</p>

¡No olvides publicar un link o un vídeo de tu proyecto en Linkedin y en nuestro canal de resultados en Discord! 🏁

Un punto importante: hay varias formas de desarrollar los desafíos, no crean que el código presentado es el correcto o el único a seguir, es una base y pueden comparar con su resolución y la de otros colegas.
12 changes: 12 additions & 0 deletions assets/Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Vector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/atari.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/babyyoda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/banner-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/camisasnes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/canecasw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/consolas-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/consolas-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/consolas-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/consolas-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/consolas-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/consolas-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/darth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/gba.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/grogu-exposito.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/jsxbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/legosw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/lupa-negro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/lupa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/mandalorian.png
Binary file added assets/mini darth.png
Binary file added assets/pikachu.png
Binary file added assets/ps5.png
Binary file added assets/relogio.png
Binary file added assets/snes.png
Binary file added assets/sonic.png
Binary file added assets/stormtropper.png
Binary file added assets/switch.png
Binary file added assets/taza trupper.png
Binary file added assets/trupper.png
Binary file added assets/vr.png
Binary file added assets/yoda.png
34 changes: 34 additions & 0 deletions controllers/actualiza-producto-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { productoServices } from "../servicios/producto-servicios.js";

const getURL = new URL(window.location);

const id = getURL.searchParams.get("id");

const inputImageUrl = document.querySelector("[data-url]");
const inputNombre = document.querySelector("[data-nombre]");
const inputPrecio = document.querySelector("[data-precio]");
const inputDescripcion = document.querySelector("[data-descripcion]");

productoServices.listarUnProduto(id).then((datos) => {
inputImageUrl.setAttribute("src", datos.imageUrl);
inputNombre.value = datos.name;
inputPrecio.value = datos.price;
inputDescripcion.value = datos.description;
});

const formulario = document.querySelector("[data-form]");

formulario.addEventListener("submit", (evento) => {
evento.preventDefault();

productoServices
.alteraProduto(
id,
inputNombre.value,
inputPrecio.value,
inputDescripcion.value
)
.then(() => {
window.location.href = "../screens/produto.html";
});
});
21 changes: 21 additions & 0 deletions controllers/crea-productos-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { productoServices } from "../servicios/producto-servicios.js";

const form = document.querySelector("[data-form]");

form.addEventListener("submit", (evento) => {
evento.preventDefault();

const nome = document.querySelector("[data-nome]").value;
const url = document.querySelector("[data-url]").value;
const preco = document.querySelector("[data-preco]").value;

productoServices
.creaProdutos(nome, url, preco)
.then((resposta) => {
window.location.href = "../screens/index.html";
console.log(resposta);
})
.catch((err) => {
console.log(err);
});
});
69 changes: 69 additions & 0 deletions controllers/lista-productos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { productoServices } from "../servicios/producto-servicios.js";
import { formatPrice } from "../formatterPrices.js";

const getProducts = (name, price, imageUrl, id) => {
const card = document.createElement("div");

const contenido = `
<div class="produto">
<div class="container">
<button class="buttonDelete" type="button">
<img class="deleteImage" src="../assets/delete.png" alt="Deletar" />
</button>
<a href="../screens/edit-product.html?id=${id}">
<button class="buttonEdit" type="button">
<img class="editImage" src="../assets/edit.png" alt="Editar" />
</button>
</a>
</div>
<img src="${imageUrl}" alt="img">
<h1 class="product-name"> ${name} </h1>
<p class="preco">${formatPrice(price)}</p>
</div>
`;
card.innerHTML = contenido;
card.dataset.id = id;
return card;
};

const productos = document.querySelector("[data-allProducts]");

productos.addEventListener("click", async (evento) => {
let deleteButton = evento.target.className === "deleteImage";
if (deleteButton) {
const producto = evento.target.closest("[data-id]");
let id = producto.dataset.id;
productoServices
.deleteProducto(id)
.then((res) => {
producto.remove();
console.log(res);
})
.catch((err) => console.log(err));
}
});

const render = async () => {
try {
const listaProductos = await productoServices.listaProductos();

listaProductos.forEach((producto) => {
productos.appendChild(
getProducts(
producto.name,
producto.price,
producto.imageUrl,
producto.id
)
);
});
} catch (err) {
console.log(err);
}
};

render();
13 changes: 13 additions & 0 deletions controllers/login-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const form = document.querySelector("[data-form]");

form.addEventListener("submit", (evento) => {
evento.preventDefault();
const email = document.querySelector("[data-email]").value;
const password = document.querySelector("[data-password]").value;

if (email.length > 5 && password.length > 5) {
window.location.href = "../screens/produto.html";
} else {
alert("Por favor, insira mais de 5 caracteres no email e senha.");
}
});
40 changes: 40 additions & 0 deletions controllers/productos-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { productoServices } from "../servicios/producto-servicios.js";
import { formatPrice } from "../formatterPrices.js";

const nuevoProduto = (name, price, imageUrl, id) => {
const card = document.createElement("div");
const contenido = `
<div class="produto">
<img src="${imageUrl}" alt="img">
<h1 class="product-name"> ${name} </h1>
<p class="preco">${formatPrice(price)}</p>
<a class="ver-produto" href="../produto.html?id=${id}">Ver Produto</a>
</div>
`;
card.innerHTML = contenido;
card.dataset.id = id;

return card;
};

const productos = document.querySelector("[data-product]");

const render = async () => {
try {
const listaProductos = await productoServices.listaProductos();
listaProductos.forEach((elemento) => {
productos.appendChild(
nuevoProduto(
elemento.name,
elemento.price,
elemento.imageUrl,
elemento.id
)
);
});
} catch (erro) {
console.log(erro);
}
};

render();
Loading

0 comments on commit edbc2c5

Please sign in to comment.