diff --git a/CLAUDE.md b/CLAUDE.md index fa65a88..758be7c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -68,9 +68,11 @@ The frontend was originally desktop-only (zero `@media` queries, fixed 228px sid - **Glass design system**: `:root` defines a dedicated token set — `--glass`/`--glass-strong` (translucent white fills), `--glass-border`, `--glass-blur`, `--glass-shadow`/`--glass-shadow-lg`, plus four `--bento-*` gradient tokens (mint/lavender/peach/rose) for tile accents. `body` has a fixed multi-blob `radial-gradient` background (`background-attachment:fixed`) that the translucent, `backdrop-filter:blur(...)` cards/sidebar/topbar/modal/login-box float over. Regular form inputs stay solid (`var(--surface)`, opaque white) — only container-level chrome (`.card`, `.modal`, `.sb`, `.topbar`, `.lo-box`) is glassy, intentionally, for text legibility. Always pair `backdrop-filter` with `-webkit-backdrop-filter` (Safari). - **Dashboard is a real Bento grid**, not just a relabeled stat row: `.bento` is a 4-column CSS grid with **explicit** `grid-column`/`grid-row` line placement per tile class (`.bento-stat`, `.bento-hero`, `.bento-aufg`, `.bento-quick`) — deliberately not relying on grid auto-placement, which does not reliably fill remaining same-row cells the way you'd expect when items of different spans are mixed. If you add/resize tiles, keep using explicit line numbers (or verify auto-placement with the debug technique below) rather than assuming `span N` will pack tiles the way you expect. -- **Responsive tables → cards**: any live-UI (non-PDF-export) table that needs to stay usable at phone width gets `class="tw rtable"` on its wrapper and `data-label="…"` on every ``. Below 700px, `.rtable` CSS turns each `` into its own glass card (label stacked above value per cell, via `td[data-label]::before{content:attr(data-label)}`) instead of squeezing table columns. Applied to: Dashboard's recent-patients table, `renderPT` (Patientenliste), `pgAufgaben`, `renderAdminDash`'s Konten table, and the Patientenakte Anträge table. Follow this pattern for any new data table — don't ship a raw `` without it. +- **Responsive tables → cards**: any live-UI (non-PDF-export) table that needs to stay usable at phone width gets `class="tw rtable"` on its wrapper and `data-label="…"` on every `` into its own glass card (label stacked above value per cell, via `td[data-label]::before{content:attr(data-label)}`) instead of squeezing table columns. Applied to: Dashboard's recent-patients table, `renderPT` (Patientenliste), `pgAufgaben`, `renderAdminDash`'s Konten table **and** its Audit-Log (originally a fixed-min-width flex list — converted to an `.rtable` specifically because flex rows with `min-width` don't degrade gracefully, unlike this pattern), and the Patientenakte Anträge table. Follow this pattern for any new data table — don't ship a raw `
`. Below 700px, `.rtable` CSS turns each `
` (or a fixed-width flex row list) without it. - **Accordion on the card view**: within `.rtable`, exactly one row is expanded at a time — the rest collapse to a single header line (`td.rt-head`, marked explicitly per table since it's usually the first `data-label` cell) and stack tightly, so scanning many rows needs far less scrolling. `rtInit()` (shared helper, defined near `escH`) wires this up: on load the first row gets `.rt-open`; clicking any row's header toggles it open and closes the others (clicks on nested `button,a,select,input,textarea,.tl` are ignored so action buttons/links inside a row still work independently of the accordion). **Every function that renders an `.rtable` must call `rtInit()` after the DOM is in place** (see `pgDash`, `renderPT`, `pgAufgaben`, `renderAdminDash`, `loadPat`) — a new table using this pattern that forgets the call will render but never expand/collapse. Cells without `data-label` (action-button columns) are never hidden by the accordion, so those buttons stay reachable even on a collapsed row. The `.rt-chev` chevron icon is `display:none` by default and only shown inside the `max-width:700px` breakpoint — without that base rule it leaks into the plain desktop/tablet `
` as a stray icon. +- **Birth-date fields use a scroll-wheel picker, not native ``**: for a care app, birth years are routinely 60-100 years in the past, and a native calendar widget forces endless "previous month" clicking. `openGebDatumPicker(hiddenId, dispId)` opens an `OM()` modal with three CSS-scroll-snap columns (Tag/Monat/Jahr, `.dwheel`/`.dwheel-col`/`.dwheel-item`, `DW_ITEM_H=38`); the centered item per column is read on confirm (`dwConfirm()`), clamped for invalid day/month combos, and written back as an ISO string. The pattern is: a visible `.dw-trigger` div (click opens the picker, shows the formatted date via `dwTriggerLabel(hiddenId, dispId)`) plus a paired `` that holds the real `YYYY-MM-DD` value everything else in the codebase already expects — so `neuCollect()`/`fillWP()`/`fillM()`/`updM()` etc. needed no changes beyond calling `dwTriggerLabel()` after programmatically setting the hidden input (e.g. when a patient is selected and auto-fills the form). Applied only to actual birth-date fields — `fgeb` (interview wizard), `wgeb` (Widerspruch-Generator), `mpgeb` (Musterbrief) — **not** to near-term admin dates (Antragsdatum, Bescheiddatum, Fällig-am, etc.), which stay native `` since a normal calendar is faster for dates within the last/next few months. Defaults to *today − 75 years* rather than today, since that's a much better starting scroll position for this app's typical patient age. If you wire the picker to a field with existing live-update behavior (Musterbrief's `updM()` was previously triggered via `oninput`), you must call that update function explicitly from `dwConfirm()` — switching to `type="hidden"` removes the inline `oninput` handler, and events dispatched on a hidden input don't automatically reach anything unless something explicitly listens for them. - **Mobile/tablet nav**: below 900px the `.sb` sidebar becomes a fixed off-canvas panel (`transform:translateX(-100%)`, slides in via `.sb.open`), toggled by a hamburger button (`#sb-toggle`, only visible in that breakpoint) and a `#sb-backdrop` overlay that closes it on tap. `toggleSidebar()`/`closeSidebar()` manage this; every nav-item click auto-closes it. Form grids (`.fg.c2/.c3`), stat grids (`.g4`), and the bento grid collapse to fewer columns at 900px/700px/560px. Modals go full-screen below 560px. Form inputs are forced to `font-size:16px` on phones to stop iOS Safari's auto-zoom-on-focus. +- **Dashboard quick-actions become a sticky bottom bar on phones**: below 560px, `.bento-quick` (the "Schnellzugriff" tile) switches from a normal bento grid cell to `position:fixed;bottom:0`, a horizontal icon-only tab bar (`.bq-hd` heading hidden, `.bq-list` buttons go icon-over-2-line-label via `-webkit-line-clamp:2`), so the primary actions never require scrolling to reach. `.bento{padding-bottom:80px}` in that same breakpoint reserves the space the fixed bar would otherwise cover — this is scoped to `.bento` specifically (not a global `#content` padding) since `.bento-quick`/`.bento` only ever exist on the Dashboard page. - **Verification gotcha #1 — internal scroll**: `.content` scrolls internally (`overflow-y:auto` inside a `height:100vh` shell), so Playwright's `page.screenshot({fullPage:true})` does **not** capture content below the fold — only the viewport. Scroll `.content` itself (`document.querySelector('.content').scrollTop = ...`) before screenshotting to see the rest. - **Verification gotcha #2 — stale template cache**: `start.py` runs with `debug=False`, so Flask's `TEMPLATES_AUTO_RELOAD` is off and Jinja caches the compiled `index.html` **in memory for the life of the process**, from the first request after startup. Editing the template while a `python start.py` process is still running from before your edit is invisible to the browser no matter how many times you reload — you'll see stale HTML/JS and it's easy to misdiagnose as a CSS/JS bug. **Always restart the server after editing `templates/index.html`** before taking verification screenshots or you'll debug a ghost. diff --git a/pflegepilot_alpha_v2/pflegepilot/templates/index.html b/pflegepilot_alpha_v2/pflegepilot/templates/index.html index 61a02a5..2faaee7 100644 --- a/pflegepilot_alpha_v2/pflegepilot/templates/index.html +++ b/pflegepilot_alpha_v2/pflegepilot/templates/index.html @@ -64,9 +64,6 @@ body{ .ni[data-p="backend"]:hover{background:var(--blbg);color:var(--bltx)} .ni[data-p="admindash"].on{background:var(--rdbg);color:var(--rdtx);border-left-color:var(--rdtx)} .ni[data-p="admindash"]:hover{background:var(--rdbg);color:var(--rdtx)} -.audit-row{display:flex;gap:10px;padding:9px 0;border-bottom:1px solid var(--border);font-size:13px} -.audit-row:last-child{border-bottom:none} -.audit-aktion{font-weight:500;flex-shrink:0;min-width:130px} .admin-pill{font-size:10px;padding:1px 7px;border-radius:9px;background:var(--ambg);color:var(--amtx);margin-left:auto;font-weight:500} .api-token-wrap{position:relative} .api-token-wrap input{padding-right:38px} @@ -137,8 +134,20 @@ body{ .bento-quick{grid-column:2/3;grid-row:auto} } @media (max-width:560px){ - .bento{grid-template-columns:1fr} - .bento-hero,.bento-aufg,.bento-quick{grid-column:1/2;grid-row:auto} + .bento{grid-template-columns:1fr;padding-bottom:80px} + .bento-hero,.bento-aufg{grid-column:1/2;grid-row:auto} + /* Schnellzugriff wird zur fixierten Bottom-Bar - kein Scrollen mehr noetig, + um an die Schnellaktionen zu kommen (siehe .bento oben: padding-bottom + reserviert den Platz, den die Bar sonst verdecken wuerde). */ + .bento-quick{ + position:fixed;left:8px;right:8px;bottom:8px;z-index:150; + grid-column:unset;grid-row:unset;padding:6px; + } + .bento-quick .bq-hd{display:none} + .bento-quick .bq-list{flex-direction:row!important;gap:2px} + .bento-quick .bq-list button{flex:1;flex-direction:column;gap:3px;padding:8px 2px;border:none;background:transparent;min-width:0} + .bento-quick .bq-list button i{font-size:19px} + .bento-quick .bq-list button span{font-size:9px;line-height:1.15;white-space:normal;text-align:center;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical} } .metric{background:rgba(255,255,255,.5);border-radius:var(--r);padding:14px 16px;border:1px solid var(--glass-border)} .ml{font-size:12px;color:var(--muted)} @@ -278,6 +287,24 @@ textarea{resize:vertical;min-height:80px} .kk-tab.active{background:var(--green);color:#fff;font-weight:600} .pat-foto-btn{cursor:pointer;flex-shrink:0;border-radius:50%;transition:box-shadow .12s} .pat-foto-btn:hover{box-shadow:0 0 0 3px rgba(29,158,117,.22)} +/* ── Geburtsdatum: Scroll-Wheel-Picker statt nativem Kalender ── + Native Datepicker zwingen bei Geburtsdaten (oft 60-100 Jahre zurück) + zu endlosem Zurückblättern. Drei scrollbare Tag/Monat/Jahr-Spalten mit + scroll-snap sind auf PC (Mausrad) wie Touch (Wisch) gleich schnell. */ +.dw-trigger{display:flex;align-items:center;gap:8px;border:1px solid var(--border2);border-radius:var(--r);padding:7px 10px;font-size:13px;background:var(--surface);cursor:pointer;color:var(--text)} +.dw-trigger:hover{border-color:var(--green)} +.dw-trigger i{color:var(--muted);font-size:15px} +.dw-trigger .dw-ph{color:var(--hint)} +.dwheel{display:flex;gap:2px;position:relative;height:190px;background:var(--bg);border-radius:var(--r);overflow:hidden;margin-bottom:4px} +.dwheel-col{flex:1;overflow-y:scroll;scroll-snap-type:y mandatory;-webkit-overflow-scrolling:touch;scrollbar-width:none;position:relative;z-index:2} +.dwheel-col::-webkit-scrollbar{display:none} +.dwheel-item{height:38px;display:flex;align-items:center;justify-content:center;scroll-snap-align:center;font-size:15px;color:var(--hint);transition:color .1s,font-size .1s;font-family:'IBM Plex Mono',monospace} +.dwheel-item.sel{color:var(--text);font-weight:600;font-size:17px} +.dwheel-highlight{position:absolute;left:6px;right:6px;top:50%;transform:translateY(-50%);height:38px;border-radius:8px;background:var(--gbg);pointer-events:none;z-index:1} +.dwheel-fade{position:absolute;left:0;right:0;height:56px;pointer-events:none;z-index:3} +.dwheel-fade.top{top:0;background:linear-gradient(var(--bg),transparent)} +.dwheel-fade.bot{bottom:0;background:linear-gradient(transparent,var(--bg))} +.dw-hint{text-align:center;font-size:11px;color:var(--muted);margin-top:6px} .pat-foto-img{width:52px;height:52px;border-radius:50%;object-fit:cover;border:2px solid var(--border);display:block} .pat-foto-empty{width:52px!important;height:52px!important;font-size:16px!important} /* ── Login-Overlay ── */ @@ -481,6 +508,91 @@ function rtInit(){ }); }); } +// ── Geburtsdatum-Wheel-Picker (Tag/Monat/Jahr-Scroll-Spalten) ─────────────── +const DW_MONATE=['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']; +const DW_ITEM_H=38; +let _dwHidden=null,_dwDisp=null; +function dwTriggerLabel(hiddenId,dispId){ + const el=document.getElementById(dispId); + const hid=document.getElementById(hiddenId); + if(!el)return; + el.innerHTML=hid&&hid.value?''+fdate(hid.value):'Datum wählen…'; +} +function openGebDatumPicker(hiddenId,dispId){ + _dwHidden=hiddenId;_dwDisp=dispId; + const cur=document.getElementById(hiddenId)?.value||''; + const heute=new Date(); + let d=heute.getDate(),m=heute.getMonth()+1,y=heute.getFullYear()-75; // sinnvoller Default für Pflege-Patienten statt "heute" + if(cur){const parts=cur.split('-');if(parts.length===3){y=parseInt(parts[0]);m=parseInt(parts[1]);d=parseInt(parts[2]);}} + const dayItems=Array.from({length:31},(_,i)=>({v:i+1,label:String(i+1)})); + const monthItems=DW_MONATE.map((n,i)=>({v:i+1,label:n})); + const yearItems=[];for(let yy=heute.getFullYear();yy>=1900;yy--)yearItems.push({v:yy,label:String(yy)}); + OM('Geburtsdatum wählen', + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
Scrollen oder mit dem Mausrad auswählen
'+ + '
'+ + ''+ + '
' + ); + dwBuildCol('dw-day',dayItems); + dwBuildCol('dw-month',monthItems); + dwBuildCol('dw-year',yearItems); + const dIdx=Math.max(0,dayItems.findIndex(x=>x.v===d)); + const mIdx=Math.max(0,monthItems.findIndex(x=>x.v===m)); + const yIdx=Math.max(0,yearItems.findIndex(x=>x.v===y)); + requestAnimationFrame(()=>{ + dwScrollTo('dw-day',dIdx);dwScrollTo('dw-month',mIdx);dwScrollTo('dw-year',yIdx); + ['dw-day','dw-month','dw-year'].forEach(id=>dwHighlight(document.getElementById(id))); + }); + ['dw-day','dw-month','dw-year'].forEach(id=>{ + const col=document.getElementById(id); + let t=null; + col.onscroll=()=>{ + dwHighlight(col); + clearTimeout(t); + t=setTimeout(()=>{ + const idx=Math.round(col.scrollTop/DW_ITEM_H); + col.scrollTo({top:idx*DW_ITEM_H,behavior:'smooth'}); + },130); + }; + }); +} +function dwBuildCol(id,items){ + const col=document.getElementById(id); + const pad=(190-DW_ITEM_H)/2; + col.innerHTML='
'+ + items.map(it=>'
'+it.label+'
').join('')+ + '
'; + col.dataset.items=JSON.stringify(items); +} +function dwScrollTo(id,idx){document.getElementById(id).scrollTop=idx*DW_ITEM_H;} +function dwHighlight(col){ + const idx=Math.round(col.scrollTop/DW_ITEM_H); + col.querySelectorAll('.dwheel-item').forEach((el,i)=>el.classList.toggle('sel',i===idx)); +} +function dwRead(id){ + const col=document.getElementById(id); + const items=JSON.parse(col.dataset.items); + const idx=Math.max(0,Math.min(Math.round(col.scrollTop/DW_ITEM_H),items.length-1)); + return items[idx].v; +} +function dwConfirm(){ + let d=dwRead('dw-day'),m=dwRead('dw-month'),y=dwRead('dw-year'); + const maxDay=new Date(y,m,0).getDate(); // Tag begrenzen, falls z.B. 31. Februar gewählt wurde + if(d>maxDay)d=maxDay; + const iso=y+'-'+String(m).padStart(2,'0')+'-'+String(d).padStart(2,'0'); + const hid=document.getElementById(_dwHidden); + if(hid){hid.value=iso;hid.dispatchEvent(new Event('change'));} + dwTriggerLabel(_dwHidden,_dwDisp); + if(_dwHidden==='mpgeb'&&typeof updM==='function')updM(); // Musterbrief-Vorschau live nachziehen + CM(); +} function editNotizen(pid){ const el=document.getElementById('notiz-display-'+pid); const current=el?el.dataset.notiz:''; @@ -1301,15 +1413,18 @@ function renderAdminDash(nutzer,log,patienten){ ''; }).join(''); const patOptions=(patienten||[]).map(p=>'').join(''); - const logRows=(log||[]).length?(log||[]).map(l=> - '
'+ - '
'+fdate(l.erstellt_am)+'
'+ - '
'+(ADMIN_AKTION_LABEL[l.aktion]||l.aktion)+'
'+ - '
'+ - '
'+escH(l.ziel_bezeichnung||'')+' ('+l.ziel_typ+' #'+l.ziel_id+')
'+ - '
von '+escH(l.admin_name||'–')+' – '+escH(l.begruendung||'')+'
'+ - '
' - ).join(''):'
Noch keine Einträge.
'; + const logRows=(log||[]).length? + '
'+ + (log||[]).map(l=> + ''+ + ''+ + ''+ + ''+ + '' + ).join('')+ + '
AktionZeitpunktZielBegründung
'+(ADMIN_AKTION_LABEL[l.aktion]||l.aktion)+'
'+ + '
'+fdate(l.erstellt_am)+'
'+fdate(l.erstellt_am)+''+escH(l.ziel_bezeichnung||'')+' ('+l.ziel_typ+' #'+l.ziel_id+')
'+escH(l.begruendung||'')+'
von '+escH(l.admin_name||'–')+'
' + :'
Noch keine Einträge.
'; R('
'+ '
Konten
'+ '
'+ @@ -1421,13 +1536,13 @@ async function pgDash(){ d.aufgaben.map(a=>'
'+ '
'+a.titel+'
'+(a.patient_name||'')+' · '+fdate(a.faellig_am)+'
').join(''))+''+ - '
Schnellzugriff
'+ - '
'+ - ''+ - ''+ - ''+ - ''+ - ''+ + '
Schnellzugriff
'+ + '
'+ + ''+ + ''+ + ''+ + ''+ + ''+ '
'+ '
', 'Dashboard', @@ -1703,7 +1818,10 @@ function neuRender(){
-
+
+
${d.geburtsdatum?''+fdate(d.geburtsdatum):'Datum wählen…'}
+ +
`; }else if(step===2){ body=`
Wo wohnt die Person?
@@ -2057,7 +2175,9 @@ async function pgWiderspruch(prefillPid){ '
'+ '
'+ '
'+ - '
'+ + '
'+ + '
Datum wählen…
'+ + '
'+ '
'+ '
'+ '
'+ @@ -2107,7 +2227,7 @@ async function fillWP(){ const pid=document.getElementById('wpid')?.value;if(!pid)return; const d=await api('/api/patienten/'+pid);const p=d.patient; const sv=(id,v)=>{const e=document.getElementById(id);if(e&&v)e.value=v;}; - sv('wname',p.vorname+' '+p.nachname);sv('wgeb',p.geburtsdatum);sv('wvnr',p.versichertennummer); + sv('wname',p.vorname+' '+p.nachname);sv('wgeb',p.geburtsdatum);dwTriggerLabel('wgeb','wgeb_disp');sv('wvnr',p.versichertennummer); sv('waddr',(p.strasse?p.strasse+', ':'')+p.plz+' '+p.ort); if(p.krankenkasse)selKK('wkk_s','wkk',p.krankenkasse); if(p.pflegegrad)sv('wist',p.pflegegrad); @@ -2310,7 +2430,9 @@ async function pgMuster(){ ''+ '
Versicherte Person
'+ '
'+ - '
'+ + '
'+ + '
Datum wählen…
'+ + '
'+ '
'+ '
Antragstyp
'+ '
NameRolleStatusPatientenAboAktionen