Skip to content

Commit

Permalink
Update styles
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusHT committed Nov 18, 2022
1 parent 8c8dabc commit 4a4e4d9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 8 deletions.
1 change: 1 addition & 0 deletions controllers/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function retiro(){
return;
}

$this -> model -> updateSaldo($cant);
$this -> generateQR($num_client, $cant);

$_SESSION['accion'] = 'Retiro';
Expand Down
15 changes: 15 additions & 0 deletions models/mainmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ function from($array){
$this -> usado = $array['usado'];
}

function updateSaldo($cant){
$nuevoSaldo = $this -> saldo - $cant;

try {
$query = $this -> prepare('UPDATE cuenta SET saldo = :saldo WHERE num_client = :num_client');
$query -> execute(['saldo' => $nuevoSaldo, 'num_client' => $this -> num_client]);

return true;

} catch (PDOException $e){
echo $e;
return false;
}
}

function cantSuficiente($cant){
if ($this -> saldo >= $cant) {
return false;
Expand Down
12 changes: 10 additions & 2 deletions public/css/cliente.css

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

Binary file modified public/img/retiro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion public/js/cliente.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ const Cant = document.getElementById("cant");
const Saldo = document.getElementById("saldo").value;

Cant.addEventListener("change", () => {

let cantidad = parseInt(Cant.value, 10);

if (cantidad <= Saldo) {
Cant.classList.remove('error');
} else {
Cant.classList.add('error');
}

});
15 changes: 13 additions & 2 deletions public/sass/cliente.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
}

input {
width: 25%;
width: 42%;
border-style: none;
border-bottom: 1px solid;
border-color: #000;
Expand All @@ -107,6 +107,9 @@
}

.error {
margin-top: 10px;
background-color: #cc05058c;
border-radius: 10px;
color: #cc0605;
border-color: #cc0605;
}
Expand All @@ -115,6 +118,10 @@
display: flex;
justify-content: right;
}

input[type=number]{
-moz-appearance: textfield;
}
}

.modal-header {
Expand All @@ -124,14 +131,18 @@
.title {
display: inline-block;
width: 50%;
h2 {
margin-left: 15px;
}
}

.closed {
display: inline-flex;
width: 48%;
width: 45%;
justify-content: right;

a {
color: #000;
cursor: pointer;
font-size: 20px;

Expand Down
4 changes: 1 addition & 3 deletions views/main/retiros.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<h2>Retiros</h2>
</div>
<div class="closed">
<form action="<?php echo constant('URL');?>/main/cerrar" method="POST">
<button type="submit"><i class="fa-solid fa-circle-xmark"></i></button>
</form>
<a href="<?php echo constant('URL');?>/main/cerrar"><i class="fa-solid fa-circle-xmark"></i></a>
</div>
<div class="modal-body">
<hr>
Expand Down

0 comments on commit 4a4e4d9

Please sign in to comment.