Skip to content

Commit

Permalink
Added the view of register and expense
Browse files Browse the repository at this point in the history
  • Loading branch information
cbdavide committed Oct 13, 2017
1 parent 4377689 commit 7c27a82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 9 additions & 0 deletions sales/static/js/gasto.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ $(document).ready(function() {
'cedula_vendedor': $('#cedula_vendedor')
}

buttons = {
'enviar': $('#enviar')
}

forms = {
'register': $('#register'),
}
Expand All @@ -14,6 +18,8 @@ $(document).ready(function() {

forms['register'].on('submit', function(e) {

buttons['enviar'].attr('disabled', true)

var price = to_int(elements['price']),
description = trimText(elements['descripcion']),
owner_document = trimText(elements['cedula_vendedor'])
Expand All @@ -23,6 +29,8 @@ $(document).ready(function() {
alert('Ingresa un precio válido')
elements['price'].val('')
elements['price'].focus()
buttons['enviar'].attr('disabled', false)


} else {
$.post('/gasto/', {
Expand All @@ -39,6 +47,7 @@ $(document).ready(function() {
alert(data.msg)
}

buttons['enviar'].attr('disabled', false)
})

}
Expand Down
12 changes: 2 additions & 10 deletions sales/templates/sales/create_expense.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ <h1>Salida</h1>

<div class="row">
<div class="col">
<div class="form-group">
<label for="bar-code">Cédula: </label>
<div class="input-group">
<span class="input-group-addon">C.C.</span>
<input type="text" class="form-control" id="cedula_vendedor" placeholder="Cédula del trabajador" required>
</div>
</div>
</div>
<div class="col">
<div class="form-group">
<label for="product-price">Precio: </label>
<div class="input-group">
Expand All @@ -48,7 +39,7 @@ <h1>Salida</h1>

<div class="form-group">
<div class=text-right>
<button type="submit" class="btn btn-primary pull-right">Enviar</button>
<button type="submit" id="enviar" class="btn btn-primary pull-right">Enviar</button>
</div>
</div>
</form>
Expand All @@ -58,6 +49,7 @@ <h1>Salida</h1>
<script src="/static/js/jquery-3.2.1.min.js"></script>
<script src="/static/js/popper.min.js"></script>
<script src="/static/js/boostrap.min.js"></script>
<script src="/static/js/index.js"></script>
<script src="/static/js/gasto.js"></script>
</body>
</html>

0 comments on commit 7c27a82

Please sign in to comment.