From 90bcc0e813f37d3d127852cb41555fff93e9ccff Mon Sep 17 00:00:00 2001 From: Diaco Soltanpour Date: Thu, 1 Oct 2026 14:23:36 +0000 Subject: [PATCH] Bump Python 3.14 and fix entry date defaults (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Bump Docker base image from `python:3.12-slim` to `python:3.14-slim` - Fix entry form: Date defaults to today, Next Control Date to Date + 6 months - Constrain form inputs so they fit the left column width ## Test plan - [ ] `docker compose up -d --build` succeeds with Python 3.14 - [ ] Open `/entry` — Date is today, Next Control is ~6 months later - [ ] Changing Date updates Next Control - [ ] Form inputs no longer overflow the left card Reviewed-on: https://git.faryad.top/rhino/product-slip/pulls/1 Co-authored-by: Diaco Soltanpour Co-committed-by: Diaco Soltanpour --- Dockerfile | 2 +- slips/static/slips/css/style.css | 4 ++++ slips/static/slips/js/entry.js | 24 ++++++++++++++++-------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6f678d..3611d60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-slim +FROM python:3.14-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 diff --git a/slips/static/slips/css/style.css b/slips/static/slips/css/style.css index 866ae69..df9aa9b 100644 --- a/slips/static/slips/css/style.css +++ b/slips/static/slips/css/style.css @@ -154,6 +154,7 @@ form { display: flex; flex-direction: column; gap: 0.5rem; + min-width: 0; } label { @@ -163,6 +164,9 @@ label { } input, select { + width: 100%; + min-width: 0; + box-sizing: border-box; background: rgba(15, 23, 42, 0.5); border: 1px solid var(--border); color: var(--text-primary); diff --git a/slips/static/slips/js/entry.js b/slips/static/slips/js/entry.js index 87ae4e7..b7d5018 100644 --- a/slips/static/slips/js/entry.js +++ b/slips/static/slips/js/entry.js @@ -1,21 +1,29 @@ document.addEventListener('DOMContentLoaded', () => { const productSelect = document.getElementById('product'); + const dateInput = document.getElementById('prod-date'); + const nextControlInput = document.getElementById('next-control'); const totalWeightInput = document.getElementById('total-weight'); const canisterWeightInput = document.getElementById('canister-weight'); const canistersPerBoxInput = document.getElementById('canisters-per-box'); const previewDisplay = document.getElementById('preview-display'); const form = document.getElementById('order-form'); - // Default dates - const today = new Date(); - dateInput.valueAsDate = today; - + // Default dates (local calendar — valueAsDate is UTC and shifts in +0330) + function localYmd(d) { + const y = d.getFullYear(); + const m = String(d.getMonth() + 1).padStart(2, '0'); + const day = String(d.getDate()).padStart(2, '0'); + return `${y}-${m}-${day}`; + } + dateInput.value = localYmd(new Date()); + // Auto calculate +6 months function updateNextControl() { - const d = new Date(dateInput.value); - if (isNaN(d)) return; + const [y, m, day] = (dateInput.value || '').split('-').map(Number); + if (!y) return; + const d = new Date(y, m - 1, day); d.setMonth(d.getMonth() + 6); - nextControlInput.valueAsDate = d; + nextControlInput.value = localYmd(d); } updateNextControl(); dateInput.addEventListener('change', updateNextControl); @@ -74,7 +82,7 @@ document.addEventListener('DOMContentLoaded', () => { if (res.ok) { showToast(currentLang === 'fa' ? 'سفارش به صف چاپ اضافه شد' : 'Order added to print queue!'); form.reset(); - dateInput.valueAsDate = today; + dateInput.value = localYmd(new Date()); updateNextControl(); updatePreview(); setTimeout(() => window.location.reload(), 1000);