feat: configure Santiago timezone and split scheduled price datetime inputs
This commit is contained in:
@@ -12,6 +12,7 @@ services:
|
||||
environment:
|
||||
- FLASK_ENV=production
|
||||
- PYTHONUNBUFFERED=1
|
||||
- TZ=America/Santiago
|
||||
volumes:
|
||||
- /home/shironeko/Documents/dockerVols/rendiciones/db:/app/db
|
||||
- /home/shironeko/Documents/dockerVols/rendiciones/static/cache:/app/static/cache
|
||||
|
||||
@@ -386,9 +386,10 @@ def delete_product(id):
|
||||
@admin_bp.route('/productos/precios/<int:id>', methods=['POST'])
|
||||
@admin_required
|
||||
def update_product_prices(id):
|
||||
fecha_input = request.form.get('fecha_activacion')
|
||||
if fecha_input:
|
||||
fecha_activacion = datetime.strptime(fecha_input, '%Y-%m-%dT%H:%M').replace(second=0)
|
||||
fecha_date = request.form.get('fecha_activacion_date')
|
||||
fecha_time = request.form.get('fecha_activacion_time') or '00:00'
|
||||
if fecha_date:
|
||||
fecha_activacion = datetime.strptime(f"{fecha_date} {fecha_time}", '%Y-%m-%d %H:%M').replace(second=0)
|
||||
else:
|
||||
fecha_activacion = datetime.now()
|
||||
|
||||
|
||||
@@ -103,7 +103,14 @@
|
||||
<label class="form-label text-warning fw-bold mb-1">
|
||||
<i class="bi bi-clock-history"></i> Programar Cambio de Precio (Opcional)
|
||||
</label>
|
||||
<input type="datetime-local" class="form-control form-control-sm mb-1" name="fecha_activacion">
|
||||
<div class="row g-2 mb-1">
|
||||
<div class="col-6">
|
||||
<input type="date" class="form-control form-control-sm" name="fecha_activacion_date">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="time" class="form-control form-control-sm" name="fecha_activacion_time">
|
||||
</div>
|
||||
</div>
|
||||
<small class="text-muted" style="font-size: 0.85em;">Si lo dejas en blanco, el cambio se aplicará inmediatamente.</small>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user