diff --git a/docs/reference/file-map.md b/docs/reference/file-map.md index 6ce4bbb..d4d6854 100644 --- a/docs/reference/file-map.md +++ b/docs/reference/file-map.md @@ -290,7 +290,7 @@ python tests/creator_dialogs_check.py # S1 creator - 0 natives, errors at fields Wave 8 adds these: ```bash -python tests/kitting_check.py # CR-009 - status set + off for Micron EUV 14 checks +python tests/kitting_check.py # CR-009/CR-010 - statuses, owner, filter 21 checks ``` **Three probes were re-pointed at `T7.1`.** `sections_check.py` 5b drove the live diff --git a/html/wp-creation-app.js b/html/wp-creation-app.js index 7d2874b..81e0d71 100644 --- a/html/wp-creation-app.js +++ b/html/wp-creation-app.js @@ -59,6 +59,34 @@ const WP_PRIORITIES = ['Normal', 'High', 'Urgent']; // ('Open'). A value stored before this set existed is kept and shown as a // legacy option - renamed sets must not orphan recorded data (CR-016's rule). const KIT_STATUSES = ['Not Started', 'Picking', 'Staged', 'In Transit', 'Delivered']; + +// CR-010 / T8.2: the warehouse owner is an ACCOUNT on the package - the person +// fulfillment bottlenecks through, named explicitly so CR-011 can notify them. +// pkgKitOwnerId is the routing; wp_kit_owner (hidden) keeps the display name so +// exports and old data keep rendering. A stored name with no matching account +// (typed before this field was account-backed, or someone since removed from +// the project) is KEPT as a selected "(no account)" option - existing packages +// must never break because the roster changed. +let pkgKitOwnerId = ''; +function buildKitOwnerPicker(){ + const sel=document.getElementById('wp_kit_owner_sel'); if(!sel) return; + const curId=pkgKitOwnerId||''; + const curName=gv('wp_kit_owner'); + let html=''+ + (projectMembers||[]).map(u=>``).join(''); + const known=(projectMembers||[]).some(u=>u.id===curId); + if(curName && !known){ + html+=``; + } + sel.innerHTML=html; + sel.onchange=function(){ + if(this.value==='__orphan__') return; // re-picking the legacy name changes nothing + const u=(projectMembers||[]).find(x=>x.id===this.value); + pkgKitOwnerId=u?u.id:''; + const hid=document.getElementById('wp_kit_owner'); + if(hid) hid.value=u?(u.full_name||u.username):''; + }; +} function buildKitStatusOptions(current){ const sel=document.getElementById('wp_kit_status'); if(!sel) return; const cur=(current!=null?current:sel.value)||''; @@ -1577,7 +1605,7 @@ function collectPackage(){ gateOverride:pkgGateOverride || undefined, assets:pkgAssets.filter(a=>a.tag||a.link||a.desc), materials:pkgMaterials.filter(m=>m.qty||m.desc), attachments:pkgAttach.filter(a=>a.doc), - kitStatus:gv('wp_kit_status'), kitOwner:gv('wp_kit_owner'), kitDate:gv('wp_kit_date'), + kitStatus:gv('wp_kit_status'), kitOwner:gv('wp_kit_owner'), kitOwnerId:pkgKitOwnerId||'', kitDate:gv('wp_kit_date'), mimoTime:gv('wp_mimo_time'), mimoLoc:gv('wp_mimo_loc'), constraints:pkgConstraints.map(c=>({name:c.name,status:c.status,comment:c.comment})), qc:gv('wp_qc'), photo:gv('wp_photo'), hold:gv('wp_hold'), @@ -2707,7 +2735,9 @@ function loadPackageIntoForm(p){ set('wp_assignee',p.assigneeId); set('wp_due',p.due); set('wp_spec',p.spec); set('wp_desc',p.desc); set('wp_hours',p.hours); buildKitStatusOptions(p.kitStatus||''); + pkgKitOwnerId=p.kitOwnerId||''; set('wp_kit_owner',p.kitOwner); set('wp_kit_date',p.kitDate); set('wp_mimo_time',p.mimoTime); set('wp_mimo_loc',p.mimoLoc); + buildKitOwnerPicker(); set('wp_actual_hrs',p.actualHrs); set('wp_installed_qty',p.installedQty); set('wp_redlines',p.redlines); set('wp_lessons',p.lessons); set('wp_bimlink',p.bimlink); set('wp_iff',p.iff); set('wp_model_area',p.modelArea); set('wp_clash',p.clash); set('wp_scan_link',p.scanLink); @@ -2793,7 +2823,7 @@ function newPackage(){ if(typeof WPUrl !== 'undefined' && window.wpCreatorReady && WPUrl.get('wp')) urlSyncPackage('', {replace:true}); editingId=null; ['wp_subject','wp_system','wp_location','wp_p6_id','wp_p6_desc','wp_wbs','wp_assignee','wp_assignees','wp_distribution','wp_due','wp_spec','wp_desc','wp_hours','wp_kit_owner','wp_kit_date','wp_mimo_time','wp_mimo_loc','wp_actual_hrs','wp_installed_qty','wp_redlines','wp_lessons','wp_bimlink','wp_model_area','wp_scan_link'].forEach(id=>{const el=document.getElementById(id); if(el) el.value='';}); - document.getElementById('wp_type').value=''; buildKitStatusOptions(''); document.getElementById('wp_cost').value=''; + document.getElementById('wp_type').value=''; buildKitStatusOptions(''); pkgKitOwnerId=''; buildKitOwnerPicker(); document.getElementById('wp_cost').value=''; const prio=document.getElementById('wp_priority'); if(prio) prio.value=WP_PRIORITY_DEFAULT; // CR-003 buildLocationPickers({building:'', floor:'', sector:''}); // CR-004 ['wp_iff','wp_clash'].forEach(id=>{const el=document.getElementById(id); if(el) el.value='';}); @@ -2837,7 +2867,7 @@ const WPData = { if(typeof ProjectData!=='undefined' && ProjectData.pushWP) ProjectData.pushWP(p, activeProjectId); return true; }, }; -let dashFilter={status:'',discipline:'',q:'',flag:'',priority:'',building:'',floor:'',sector:''}; +let dashFilter={status:'',discipline:'',q:'',flag:'',priority:'',building:'',floor:'',sector:'',kitOwner:''}; // A write has to reach the server before the server can count it. The outbox is // the only path writes take, so flush it and then re-read - otherwise the refresh // races the push and shows the pre-write totals, which is the same stale number @@ -3241,11 +3271,17 @@ function renderDashboard(){ const discList=Object.keys(byDisc); const discOpts=[''].concat(discList.map(d=>``)).join(''); const prioOpts=[''].concat(WP_PRIORITIES.map(v=>``)).join(''); + // CR-010: filter by warehouse owner, so the person doing fulfillment sees + // exactly their queue. Options are the owners PRESENT in the data - a filter + // offering people with nothing to fulfill is noise. + const kitOwners=[...new Set(all.map(p=>(p.kitOwner||'').trim()).filter(Boolean))].sort(); + const kitOpts=[''].concat(kitOwners.map(v=>``)).join(''); h+=`