-
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
Francisco Johnatan
committed
May 22, 2018
0 parents
commit dc7170a
Showing
197 changed files
with
46,339 additions
and
0 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,28 @@ | ||
<?php | ||
|
||
require_once '../Model/Desconto.class.php'; | ||
|
||
$srv = new Desconto(); | ||
|
||
$nome = $_POST['nomeDesconto']; | ||
if(is_string($nome)): | ||
echo 'É do tipo String.'; | ||
else: | ||
echo 'Não é do tipo String.'; | ||
endif; | ||
|
||
$valorDesconto = $_POST['valorDesconto']; | ||
$valorDesconto = intval($valorDesconto); | ||
if(is_integer($valorDesconto)): | ||
echo 'É do tipo Integer.'; | ||
else: | ||
echo 'Não é do tipo Integer.'; | ||
endif; | ||
|
||
$dataDesconto = $_POST['dataDesconto']; | ||
|
||
//Insere os dados do Desconto | ||
if($srv->insert($nome,$dataDesconto,$valorDesconto)): | ||
header("Location: ../View/desconto.php"); /* Redirect browser */ | ||
exit(); | ||
endif; |
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,31 @@ | ||
<?php | ||
|
||
require_once '../Model/Produto.class.php'; | ||
require_once '../Model/Imagem.class.php'; | ||
|
||
$nome = $_POST['nomeProduto']; | ||
$desc = $_POST['descProduto']; | ||
$valor = $_POST['valorProduto']; | ||
|
||
|
||
$nomeDaImagem = $_FILES['fotoProduto']['name']; | ||
$tipoDaImagem = $_FILES['fotoProduto']['type']; | ||
$bitesDaImagem = $_FILES['fotoProduto']['tmp_name']; | ||
|
||
$p = new Produto(); | ||
$i = new Imagem(); | ||
|
||
//Insere os dados da Imagem e retorna o Id dela para relacionar com a tabela de Imagens | ||
$idImg = $i->insert($nomeDaImagem,$bitesDaImagem,$tipoDaImagem); | ||
|
||
//Verifica se a pessoa quis cadastrar um desconto | ||
if(!empty($_POST['desconto']) && $_POST['desconto'] != 0): | ||
$desconto = $_POST['desconto']; | ||
$p->insertComDesconto($nome,$valor,$desc,$idImg,$desconto); | ||
header("Location: ../View/index.php"); /* Redirect browser */ | ||
exit(); | ||
else: | ||
$p->insertSemDesconto($nome,$valor,$desc,$idImg); | ||
header("Location: ../View/index.php"); /* Redirect browser */ | ||
exit(); | ||
endif; |
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,27 @@ | ||
<?php | ||
require_once '../database/conexao.php'; | ||
|
||
class Desconto | ||
{ | ||
private $nome; | ||
private $dataFim; | ||
private $valor; | ||
|
||
//Insere os dados do desconto | ||
public function insert($nome,$dataFim,$valor) | ||
{ | ||
$con = conexao(); | ||
$query = "INSERT INTO descontos(valor,dataFim,nome) VALUES (:valor,:dataFim,:nome)"; | ||
$stmt = $con->prepare($query); | ||
$stmt->bindValue(':valor',$valor); | ||
$stmt->bindValue(':dataFim',$dataFim); | ||
$stmt->bindValue(':nome',$nome); | ||
if($stmt->execute()): | ||
return true; | ||
else: | ||
return false; | ||
endif; | ||
|
||
} | ||
|
||
} |
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,26 @@ | ||
<?php | ||
|
||
require_once '../database/conexao.php'; | ||
|
||
class Imagem | ||
{ | ||
private $foto; | ||
private $tipo; | ||
private $nomeImg; | ||
|
||
//Insere os dados da imagem | ||
public function insert($nome,$foto,$tipo) | ||
{ | ||
$con = conexao(); | ||
$query = "INSERT INTO fotos(foto,tipo,nome) VALUES(:foto,:tipo,:nome)"; | ||
$stmt = $con->prepare($query); | ||
$stmt->bindValue(':foto',$foto); | ||
$stmt->bindValue(':tipo',$tipo); | ||
$stmt->bindValue(':nome',$nome); | ||
$stmt->execute(); | ||
//returno id adicionado | ||
return $con->lastInsertId(); | ||
} | ||
|
||
|
||
} |
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,40 @@ | ||
<?php | ||
require_once '../database/conexao.php'; | ||
|
||
class Produto | ||
{ | ||
private $nome; | ||
private $preco; | ||
private $desc; | ||
private $id_foto; | ||
private $id_desconto; | ||
|
||
//Insere os dados do produto com desconto | ||
public function insertComDesconto($nome,$preco,$desc,$id_foto,$id_desconto) | ||
{ | ||
$con = conexao(); | ||
$query = "INSERT INTO produto(nome,preco,descricao,id_foto,id_desconto) VALUES(:nome,:preco,:descr,:id_foto,:id_desconto)"; | ||
$stmt = $con->prepare($query); | ||
$stmt->bindValue(':nome',$nome); | ||
$stmt->bindValue(':preco',$preco); | ||
$stmt->bindValue(':descr',$desc); | ||
$stmt->bindValue(':id_foto',$id_foto); | ||
$stmt->bindValue(':id_desconto',$id_desconto); | ||
$stmt->execute(); | ||
} | ||
|
||
//Insere os dados do produto sem desconto | ||
public function insertSemDesconto($nome,$preco,$desc,$id_foto) | ||
{ | ||
$con = conexao(); | ||
$query = "INSERT INTO produto(nome,preco,descricao,id_foto) VALUES(:nome,:preco,:descr,:id_foto)"; | ||
$stmt = $con->prepare($query); | ||
$stmt->bindValue(':nome',$nome); | ||
$stmt->bindValue(':preco',$preco); | ||
$stmt->bindValue(':descr',$desc); | ||
$stmt->bindValue(':id_foto',$id_foto); | ||
$stmt->execute(); | ||
|
||
} | ||
|
||
} |
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,48 @@ | ||
# Easy money :moneybag: | ||
|
||
## 🎩 Porque usar Easy money? | ||
|
||
Simples: Ele é simples! | ||
Estranho? Talvez, mas diferente de outros sistemas de venda o Easy money foca no que você está procurando: | ||
|
||
* Armazenar Produtos | ||
* Calcular Frete | ||
* Oferecer desconto por prazos | ||
* Enviar para o seu E-mail as vendas realizadas | ||
|
||
Tudo isso em uma interface simples para se utilizar e instalar, sendo o mais direto possível. | ||
|
||
## 🙌🏼 Como posso contribuir? | ||
|
||
O projeto é 100% livre, ou seja, você pode usar como quiser. Pode dar um fork e ajudar no projeto, afinal é um pequeno projeto e estou longe de saber tudo. | ||
|
||
> OBS: Projeto utiliza o PHP Puro, apenas com algumas bibliotecas para facilitar o desenvolvimento. | ||
|
||
## 📚 O que é utilizado no sistema? | ||
|
||
* MySQL (Depois vai ter PostgreSQL :D ) | ||
* PHP Puro | ||
* Algumas bibliotecas especificas em PHP e JS (Não vamos reiventar a roda em algumas partes) | ||
* Composer( Para ajudar a gerenciar as bibliotecas e seguir a PSR 4) | ||
* JavaScript | ||
* HTML5 | ||
* CSS3 | ||
* Bootstrap4 | ||
* Sass (Fica mais fácil de fazer manutenções futuras) | ||
|
||
## Como utilizar? | ||
|
||
Faça um clone do repositório: | ||
|
||
> git clone https://github.com/JohnatanT/EasyMoney.git | ||
Importe o banco de dados para o seu mysql: | ||
|
||
> Banco de dados será disponibilizado mais a frente | ||
Vá no arquivo database/conexao.php, lá irá ter as constantes com os as configurações de conexão do banco de dados | ||
|
||
> Se você utiliza o XAMPP padrão(sem não ter alterado nada) então não precisa configurar nada, os valores estão como default dele. | ||
Agora basta abrir a aplicação pelo seu servidor HTTP e começar a utilizar(e contribuir :) )! |
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,113 @@ | ||
<?php | ||
require_once '../database/conexao.php'; | ||
?> | ||
|
||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | ||
<title>Cadastro do Produto - EasyMoney</title> | ||
|
||
<!-- Bootstrap --> | ||
<link href="../public/css/bootstrap.min.css" rel="stylesheet"> | ||
<link href="../public/css/estilo.css" rel="stylesheet"> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||
<!--[if lt IE 9]> | ||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> | ||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | ||
<![endif]--> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
|
||
<!-- As a link --> | ||
<nav class="navbar navbar-light bg-light"> | ||
<a class="navbar-brand" href="index.php">Página Principal</a> | ||
<form class="form-inline"> | ||
<button type="button" class="btn btn-outline-primary"><a href="desconto.php">Cadastrar Desconto <i class="fa fa-barcode"></i></a> </button> | ||
<button type="button" class="btn btn-outline-success"><a href="cad_produto.php">Cadastrar Produto <i class="fa fa-shopping-cart"></i></a> </button> | ||
</form> | ||
|
||
</nav> | ||
|
||
<div class="container" id="texto-cadProd"> | ||
<h2>Cadastro de Produtos <i class="fas fa-list-ol"></i></h2> | ||
<p>Cadastre abaixo um novo produto para que ele possa ser vendido! Além de cadastrar o produto você pode adicionar um desconto já cadastrado, isso fará com que o produto tenha o preço subtraido do desconto pelo periodo de tempo estabelecido.</p> | ||
</div> | ||
|
||
<div class="container"> | ||
<div class="row cadProd"> | ||
<form method="POST" action="../Controller/ProdutoController.php" enctype="multipart/form-data"> | ||
<div class="col-md-12"> | ||
<div class="form-group"> | ||
<label for="nomeProduto">Nome do Produto</label> | ||
<input type="text" class="form-control" name="nomeProduto" id="nomeProduto"> | ||
</div> | ||
</div> | ||
<div class="col-md-12"> | ||
<div class="form-group"> | ||
<label for="descProduto">Descrição do Produto</label> | ||
<input type="text" class="form-control" name="descProduto" id="descProduto"> | ||
</div> | ||
</div> | ||
<div class="col-md-12"> | ||
<div class="form-group"> | ||
<label for="valorProduto">Valor do Produto</label> | ||
<div class="input-group mb-3"> | ||
<div class="input-group-prepend"> | ||
<span class="input-group-text">R$</span> | ||
<span class="input-group-text">0.00</span> | ||
</div> | ||
<input type="text" placeholder="Digite o valor" name="valorProduto" class="money form-control" id="valorProduto" aria-label="Valor (em reais)"> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-12"> | ||
<div class="form-group"> | ||
<label for="fotoProduto">Foto do Produto</label> | ||
<input type="file" class="form-control-file" name="fotoProduto" id="fotoProduto"> | ||
</div> | ||
</div> | ||
<div class="col-md-12"> | ||
<h3>Deseja aplicar um desconto? Escolha um!</h3> | ||
<button type="button" id="selectDesc" class="btn btn-warning">Escolher Desconto</button> | ||
<select name="desconto" id-"desconto" class="form-control"> | ||
<option value="0">Sem Desconto</option> | ||
<?php | ||
$con = conexao(); | ||
$query = "SELECT * from descontos"; | ||
$stmt = $con->prepare($query); | ||
$stmt->execute(); | ||
//$row = $stmt->fetch(PDO::FETCH_OBJ); | ||
//var_dump($row); | ||
while($row = $stmt->fetch(PDO::FETCH_OBJ)){ | ||
|
||
?> | ||
|
||
<option value="<?php echo $row->id; ?>">Nome: <?php echo $row->nome; ?> | Prazo: <?php echo $row->dataFim ?> | Valor: R$ <?php echo $row->valor; ?> </option> | ||
<?php | ||
} | ||
?> | ||
</select> | ||
</div> | ||
<button type="submit" id="cadProduto" class="btn btn-outline-danger">Cadastrar</button> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<!-- Include all compiled plugins (below), or include individual files as needed --> | ||
<!-- JQuery Mask --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.js"></script> | ||
<script src="../public/js/bootstrap.min.js"></script> | ||
<script src="../public/js/script.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.