new file: app.py
new file: rendiciones.db new file: templates/admin_productos.html new file: templates/admin_rendicion_detail.html new file: templates/admin_rendiciones.html new file: templates/admin_structure.html new file: templates/admin_workers.html new file: templates/base.html new file: templates/edit_producto.html new file: templates/edit_worker.html new file: templates/login.html new file: templates/navbar.html new file: templates/worker_dashboard.html
This commit is contained in:
78
templates/edit_producto.html
Normal file
78
templates/edit_producto.html
Normal file
@@ -0,0 +1,78 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<h2 class="mb-4">Editar Producto</h2>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message|safe }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Zona</label>
|
||||
<select class="form-select" name="zona_id" required>
|
||||
<option value="" disabled>Seleccionar Zona...</option>
|
||||
{% for zona in zonas %}
|
||||
<option value="{{ zona[0] }}" {% if zona[0] == producto[1] %}selected{% endif %}>
|
||||
{{ zona[1] }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nombre del Producto</label>
|
||||
<input type="text" class="form-control" name="name" value="{{ producto[2] }}" required>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Precio de Venta</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input" name="price" value="{{ producto[3]|int }}" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Comisión</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input" name="commission" value="{{ producto[4]|int }}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<a href="{{ url_for('manage_products') }}" class="btn btn-secondary">Cancelar</a>
|
||||
<button type="submit" class="btn btn-primary">Actualizar Producto</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.querySelectorAll('.money-input').forEach(function(input) {
|
||||
input.addEventListener('input', function(e) {
|
||||
let value = this.value.replace(/\D/g, '');
|
||||
if (value !== '') {
|
||||
this.value = parseInt(value, 10).toLocaleString('es-CL');
|
||||
} else {
|
||||
this.value = '';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Artificially trigger the input event on load to format the raw DB numbers
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.money-input').forEach(input => {
|
||||
input.dispatchEvent(new Event('input'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user