Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions algoritmos/exercicio_1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simulção de vendas</title>
<link rel="stylesheet" href="style/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300&display=swap" rel="stylesheet">
</head>

<body>
<div class="container">
<section class="register">
<form action="" class="info">
<input type="text" name="" id="" class="code" placeholder="Insira o código do item:">
<input type="text" name="" id="" class="nome_item" placeholder="Insira o nome do item:">
<input type="text" name="" id="" class="valor" placeholder="Insira o valor do item:">
<input type="text" name="" id="" class="quantia" placeholder="Insira a quantidade de item:">
<input type="button" value="Registrar" class="btn">
</form>
</section>
<section class="info_display">
</section>
</div>
<section class="list">
<div class="total">
<h2>Valor total de sua compra:</h2>
</div>
</section>
<script src="js/script.js"></script>
</body>

</html>
60 changes: 60 additions & 0 deletions algoritmos/exercicio_1/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
var btn_catch = document.querySelector('.btn');
var discount = 0;
const store = [];
var total = 0;


function total_price() {
let values = [];
for (let index = 0; index < store.length; index++) {
values.push(store[index].final);

}
total = values.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
console.log(total);
document.querySelector('.list h2').innerHTML = `Valor total: ${total}`;
}


btn_catch.addEventListener('click',()=>{
var item_code = document.querySelector('.code').value;
var item_value = document.querySelector('.valor').value;
var item_num = document.querySelector('.quantia').value;
var nome_item = document.querySelector('.nome_item').value;
var i = i;
var date = new Date();
date = date.toLocaleDateString()
Final_Price(item_value,item_num);
const sold = {sold_number:i,code:item_code,date:date,nome:nome_item,value:discount,quantity:item_num,final:discount};


store.push(sold);

for(var j = 0;j<store.length;j++){
var render = document.querySelector(".info_display");
render.innerHTML =`
<div class="info_wrapper">
<span>Item:`+store[j].nome+`</span>
<span>Preço:`+store[j].value+`</span>
<span>Data de compra:`+store[j].date+`</span>
</div>`;
}
console.log(store);
total_price();
i+=1;
})


function Final_Price(value,quantity){

if(quantity>10){
discount = (value - (value*0.05))*quantity;
}else if(quantity>20){
discount = (value - (value*0.1))*quantity;
}else if(quantity>30){
discount = (value - (value*0.20))*quantity;
}else{
discount = value*quantity;
}
}

137 changes: 137 additions & 0 deletions algoritmos/exercicio_1/style/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
*{
margin:0;
padding:0;
box-sizing: border-box;
font-family: 'Lato', sans-serif;
}

html,body{
height:100%;
}

body{
background-color: #c7d6cc;

}

.container{
width:100%;
height: 100%;
display: flex;
}
.register{
width:50%;
height:100%;

}

.info{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
}

.code,.valor,.quantia,.nome_item{
width:70%;
height: 60px;
background-color: transparent;
border: none;
border-bottom: 4px solid #3bd46e;
color: rgb(255, 255, 255);
font-size: 24px;
padding:2%;
margin-top: 5%;
filter:drop-shadow(0 4px 4px rgba(0,0,0,0.4));
}

.quantia::placeholder{
color: white;;
}

.valor::placeholder{
color: white;;
}

.code::placeholder{
color: white;;
}

.nome_item::placeholder{
color: white;
}


.info input[type = button]{
cursor: pointer;
width:200px;
height:60px;
color: #3bd46e;
font-size: 18px;
margin:5% 0;
background-color: transparent;
border: 3px solid #3bd46e;
transition: 0.2s;
filter:drop-shadow(0 4px 4px rgba(0, 0, 0, 0.164));
}

.info input[type = button]:hover{
background-color: #3bd46e;
color:white;
}

.info_display{
width: 50%;
height:100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.info_display::-webkit-scrollbar{
display: none;
}

.info_wrapper{
height:60px;
width:90%;
background-color: #3bd46e;
filter:drop-shadow(0 4px 4px rgba(0,0,0,0.4));
border-radius: 2rem;
display: flex;
align-items: center;
padding:0 2%;
}

.info_wrapper span{
margin: 0 5%;
font-size: 24px;
color:white;
}

.list{
width:100%;
height: 120px;
text-align: center;
color:white;
font-size: 32px;
}

@media screen and (max-width:1550px){
.container{
height: auto;
flex-direction: column;
}
.register{
width: 100%;
}
.info_display{
width: 100%;
}

.list{
padding:2%;
}
}
Loading