desk status started

This commit is contained in:
Seth Trowbridge 2025-11-02 21:21:40 -05:00
parent f47ab32d68
commit e682b8a619
3 changed files with 42 additions and 18 deletions

42
app.js
View File

@ -108,9 +108,6 @@ const deskRender = van.state(0);
/** @type {(inDesks:Record<string, TYPES.Desk>)=>HTMLElement} */ /** @type {(inDesks:Record<string, TYPES.Desk>)=>HTMLElement} */
function Desks(inDesks) function Desks(inDesks)
{ {
return Div.PartGroup( return Div.PartGroup(
Object.entries(inDesks).map(([desk_id, desk])=>{ Object.entries(inDesks).map(([desk_id, desk])=>{
@ -135,9 +132,10 @@ function Desks(inDesks)
} }
} }
let emptyCount = 0;
/** @type {(part:TYPES.Part, index:number, pass:TYPES.Pass, dirty:number[], type:"need"|"make")=>HTMLElement|null} */ /** @type {(part:TYPES.Part, index:number, array:TYPES.Part[], pass:TYPES.Pass, dirty:number[], type:"need"|"make")=>HTMLElement|null} */
const Iterator = (part, index, pass, dirty, type)=>{ const Iterator = (part, index, array, pass, dirty, type)=>{
const partPass = part.pass.get(pass); const partPass = part.pass.get(pass);
if(partPass) if(partPass)
@ -145,10 +143,19 @@ function Desks(inDesks)
const time = partPass.time; const time = partPass.time;
const latest = partPass.work.find(t=>t[0] == time); const latest = partPass.work.find(t=>t[0] == time);
if(type == "need")
{
if(!latest)
{
emptyCount++;
}
}
const attributes = { const attributes = {
class: dirty.includes(index) ? Tag("DeskDirty") : "", class: dirty.includes(index) ? Tag("DeskDirty") : (type == "need"&&!latest) ? Tag("PartEmpty") : ""
}; };
if(type == "make") if(type == "make")
{ {
attributes.onclick=function(){ attributes.onclick=function(){
@ -183,22 +190,33 @@ function Desks(inDesks)
const work = []; const work = [];
for(const [pass, dirty] of desk.pass) for(const [pass, dirty] of desk.pass)
{ {
emptyCount = 0;
const need = desk.need.map((part, index, array)=>Iterator(part, index, array, pass, dirty.need, "need"));
if(desk.need.length == 0 || emptyCount == 0)
{
}
work.push(DOM.tr( work.push(DOM.tr(
DOM.td(pass.name), DOM.td(pass.name),
desk.need.map((part, index)=>Iterator(part, index, pass, dirty.need, "need")), need,
DOM.td("->"), DOM.td("->"),
desk.make.map((part, index)=>Iterator(part, index, pass, dirty.make, "make")) desk.make.map((part, index, array)=>Iterator(part, index, array, pass, dirty.make, "make"))
)) ))
} }
return Div.DeskContainer( return Div.DeskContainer(
DOM.h3(desk.name), DOM.h3(desk.name),
DOM.table.GapHorizontal( DOM.table.GapHorizontal(
DOM.thead( DOM.thead(
DOM.th(), DOM.tr(
desk.need.map((part, index)=>DOM.th(part.name)), DOM.th(),
DOM.th(), desk.need.map((part, index)=>DOM.th(part.name)),
desk.make.map((part, index)=>DOM.th(part.name)) DOM.th(),
desk.make.map((part, index)=>DOM.th(part.name))
)
), ),
work work
) )

View File

@ -2,9 +2,12 @@
import CreateAllRooms, {Room} from "../../graph/graph.js"; import CreateAllRooms, {Room} from "../../graph/graph.js";
const user = { const user = {
u1:"Seth Trowbridge", u1:"Seth T",
u4:"Sarah Sharp", u4:"Sarah S",
u5:"Adam Marshall", u5:"Adam M",
u6:"Matt Y",
u7:"Seth F",
u8:"Brittany F"
} }
export default CreateAllRooms({ export default CreateAllRooms({

View File

@ -14,6 +14,9 @@ export default Gale({
borderRadius: `5px`, borderRadius: `5px`,
padding: `1rem` padding: `1rem`
}, },
PartEmpty:{
background:"gray"
},
BlockScreen:{ BlockScreen:{
position: "fixed", position: "fixed",
zIndex: "9999", zIndex: "9999",
@ -30,14 +33,14 @@ export default Gale({
}, },
DeskDirty:{ DeskDirty:{
background:"tomato", background:"tomato",
color:"white" color:"white",
}, },
GapHorizontal:{ GapHorizontal:{
borderCollapse:"separate", borderCollapse:"separate",
borderSpacing:"0 2rem" borderSpacing:"0 2rem",
}, },
GapVertical:{ GapVertical:{
borderCollapse:"separate", borderCollapse:"separate",
borderSpacing:"2rem 0.2rem" borderSpacing:"2rem 0.2rem",
} }
}); });