diff --git a/static/assets/index-elzVJagq.js b/static/assets/index-MZV8iNil.js similarity index 99% rename from static/assets/index-elzVJagq.js rename to static/assets/index-MZV8iNil.js index 1bca40e15..77a818dcb 100644 --- a/static/assets/index-elzVJagq.js +++ b/static/assets/index-MZV8iNil.js @@ -8503,7 +8503,7 @@ void main() { border-l-[5px] border-l-transparent border-r-[5px] border-r-transparent border-t-[5px] border-t-bambu-dark-tertiary - `})]})]})}function Tae({isOpen:t,onClose:e,tagUid:n,trayUuid:r,printerId:i,amsId:s,trayId:o}){const{t:l}=Rt(),c=hn(),{showToast:d}=xn(),[u,m]=w.useState(""),p=r||n,{data:f,isLoading:y}=Ze({queryKey:["unlinked-spools"],queryFn:pe.getUnlinkedSpools,enabled:t}),v=w.useMemo(()=>f?f.filter(g=>{if(!u)return!0;const _=u.toLowerCase();return g.filament_name&&g.filament_name.toLowerCase().includes(_)||g.filament_material&&g.filament_material.toLowerCase().includes(_)||String(g.id).includes(_)}):[],[f,u]),b=lt({mutationFn:g=>pe.linkSpool(g,{spoolTag:p,printerId:i,amsId:s,trayId:o}),onSuccess:()=>{c.invalidateQueries({queryKey:["unlinked-spools"]}),c.invalidateQueries({queryKey:["linked-spools"]}),d(l("spoolman.linkSuccess"),"success"),e()},onError:g=>{d(g.message||l("spoolman.linkFailed"),"error")}});return t?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),a.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl shadow-xl w-full max-w-md mx-4 max-h-[80vh] flex flex-col border border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/10",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[a.jsx(ty,{className:"w-5 h-5 text-bambu-green"}),l("spoolman.selectSpool")]}),a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["AMS ",s," T",o," · Printer #",i]})]}),a.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:a.jsx(qt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 border-b border-white/10",children:[a.jsxs("div",{className:"relative",children:[a.jsx(_r,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),a.jsx("input",{type:"text",value:u,onChange:g=>m(g.target.value),placeholder:l("inventory.searchSpools"),className:"w-full pl-9 pr-3 py-2 bg-bambu-dark rounded-lg border border-white/10 text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green"})]}),(r||n)&&a.jsxs("p",{className:"text-xs text-bambu-gray mt-2 font-mono truncate",title:r||n,children:["Tag: ",r||n]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:y?a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):v.length===0?a.jsx("p",{className:"text-center text-bambu-gray py-8 text-sm",children:l("inventory.noSpoolsMatch")}):v.map(g=>a.jsxs("button",{onClick:()=>b.mutate(g.id),disabled:b.isPending||!p,className:"w-full flex items-center gap-3 p-3 rounded-lg hover:bg-white/5 transition-colors text-left",children:[a.jsx("span",{className:"w-6 h-6 rounded-full border border-black/20 flex-shrink-0",style:{backgroundColor:g.filament_color_hex?`#${g.filament_color_hex}`:"#808080"}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-white font-medium truncate",children:g.filament_name||l("spoolman.spoolId")}),a.jsxs("div",{className:"text-xs text-bambu-gray truncate",children:[g.filament_material||"Unknown"," · #",g.id]})]}),a.jsx("span",{className:"text-xs text-bambu-gray",children:g.remaining_weight!=null?`${Math.round(g.remaining_weight)}g`:"—"})]},g.id))}),a.jsx("div",{className:"p-4 border-t border-white/10 flex justify-end",children:a.jsx(Ie,{variant:"ghost",onClick:e,children:l("inventory.cancel")||"Cancel"})})]})]}):null}function Aae({isOpen:t,onClose:e,printerId:n,amsId:r,trayId:i,trayInfo:s}){const{t:o}=Rt(),l=hn(),{showToast:c}=xn(),[d,u]=w.useState(!1),[m,p]=w.useState(null);w.useEffect(()=>{p(null)},[d]);const[f,y]=w.useState(""),[v,b]=w.useState(null),[g,_]=w.useState(!1),[k,P]=w.useState(null);w.useEffect(()=>{t&&u(!1)},[t]);const{data:N,isLoading:M}=Ze({queryKey:["inventory-spools"],queryFn:()=>pe.getSpools(),enabled:t}),{data:T}=Ze({queryKey:["spool-assignments"],queryFn:()=>pe.getAssignments(),enabled:t}),{data:A}=Ze({queryKey:["settings"],queryFn:()=>pe.getSettings(),enabled:t}),C=lt({mutationFn:oe=>pe.assignSpool({spool_id:oe,printer_id:n,ams_id:r,tray_id:i}),onSuccess:oe=>{l.setQueryData(["spool-assignments"],ue=>{const K=(ue||[]).filter(ae=>!(ae.printer_id===n&&ae.ams_id===r&&ae.tray_id===i));return K.push(oe),K}),l.invalidateQueries({queryKey:["spool-assignments"]}),c(o("inventory.assignSuccess"),"success"),_(!1),b(null),P(null),e()},onError:oe=>{c(`${o("inventory.assignFailed")}: ${oe.message}`,"error")}}),F=oe=>(oe??"").trim().toUpperCase(),V=(oe,ue)=>{const K=F(oe),ae=F(ue);return!K||!ae?"none":K===ae?"exact":ae.includes(K)||K.includes(ae)?"partial":"none"},I=(oe,ue)=>{const K=F(oe),ae=F(ue);return!K||!ae?!1:K===ae};if(!t)return null;const Y=new Set((T||[]).filter(oe=>!(oe.printer_id===n&&oe.ams_id===r&&oe.tray_id===i)).map(oe=>oe.spool_id)),L=r===254||r===255,ne=N?.filter(oe=>!Y.has(oe.id)&&(L||!oe.tag_uid&&!oe.tray_uuid));let ie=ne;if(!d&&(s?.profile||s?.type)){const oe=F(s.profile||s.type);ie=ie?.filter(ue=>{const K=F(ue.slicer_filament_name||ue.slicer_filament);return oe&&K&&K===oe})}if(f&&ie){const oe=f.toLowerCase();ie=ie.filter(ue=>ue.material.toLowerCase().includes(oe)||(ue.brand?.toLowerCase().includes(oe)??!1)||(ue.color_name?.toLowerCase().includes(oe)??!1)||(ue.subtype?.toLowerCase().includes(oe)??!1))}const ee=()=>{if(!m)return;const oe=N?.find(ue=>ue.id===m);if(!oe){c(o("inventory.assignFailed"),"error");return}if(!A?.disable_filament_warnings&&s){const ue=s.material||s.type,K=V(oe.material,ue),ae=oe.slicer_filament_name||oe.slicer_filament,ce=s.profile||s.type,ye=I(ae,ce);if(K!=="exact"||!ye){let Ne="profile";K==="none"&&!ye?Ne="material_profile":K==="partial"&&!ye?Ne="partial_profile":K==="none"?Ne="material":K==="partial"&&(Ne="partial"),b(m),P({type:Ne,spoolMaterial:oe.material||"",trayMaterial:ue||"",spoolProfile:ae||void 0,trayProfile:ce||void 0}),_(!0);return}}C.mutate(m)},de=()=>{v&&(C.mutate(v),_(!1),b(null))};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start sm:items-center justify-center p-4 overflow-y-auto",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),a.jsxs("div",{className:"relative w-full max-w-2xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] overflow-hidden flex flex-col my-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ta,{className:"w-5 h-5 text-bambu-green"}),a.jsx("h2",{className:"text-lg font-semibold text-white",children:o("inventory.assignSpool")})]}),a.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:a.jsx(qt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto",children:[s&&a.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[a.jsxs("p",{className:"text-xs text-bambu-gray mb-1",children:[o("inventory.selectSpool"),":"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s.color&&a.jsx("span",{className:"w-4 h-4 rounded-full border border-black/20",style:{backgroundColor:`#${s.color}`}}),a.jsx("span",{className:"text-white font-medium",children:s.type||o("ams.emptySlot")}),a.jsxs("span",{className:"text-bambu-gray",children:["(",s.location,")"]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(_r,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),a.jsx("input",{type:"text",value:f,onChange:oe=>y(oe.target.value),placeholder:o("inventory.searchSpools"),className:"w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green"})]}),a.jsx("div",{children:M?a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):ie&&ie.length>0?a.jsx("div",{className:"max-h-96 overflow-y-auto grid grid-cols-2 sm:grid-cols-3 gap-2",children:ie.map(oe=>a.jsxs("button",{onClick:()=>p(oe.id),title:oe.note||void 0,className:`p-2.5 rounded-lg border text-left transition-colors ${m===oe.id?"bg-bambu-green/20 border-bambu-green":"bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:[a.jsxs("p",{className:"text-white text-sm font-medium truncate",children:[oe.brand?`${oe.brand} `:"",oe.material,oe.subtype?` ${oe.subtype}`:""]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[oe.rgba&&a.jsx("span",{className:"w-3 h-3 rounded-full border border-black/20 flex-shrink-0",style:{backgroundColor:`#${oe.rgba.substring(0,6)}`}}),a.jsx("span",{className:"text-xs text-bambu-gray truncate",children:oe.color_name||""})]}),oe.label_weight&&a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[Math.max(0,Math.round(oe.label_weight-oe.weight_used))," / ",oe.label_weight,"g"]})]},oe.id))}):ne&&ne.length===0?a.jsx("div",{className:"text-center py-8 text-bambu-gray",children:a.jsx("p",{children:o("inventory.noManualSpools")})}):a.jsx("div",{className:"text-center py-8 text-bambu-gray",children:a.jsx("p",{children:o("inventory.noSpoolsMatch")})})})]}),a.jsxs("div",{className:"flex justify-between items-center p-4 border-t border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"disable-filtering-toggle",type:"checkbox",checked:d,onChange:()=>u(oe=>!oe),className:"accent-bambu-green w-4 h-4 rounded focus:ring-0 border-bambu-dark-tertiary"}),a.jsx("label",{htmlFor:"disable-filtering-toggle",className:"text-xs text-bambu-gray select-none cursor-pointer",children:o("inventory.showAllSpools")})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ie,{variant:"secondary",onClick:e,children:o("common.cancel")}),a.jsx(Ie,{onClick:ee,disabled:!m||C.isPending,children:C.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"w-4 h-4 animate-spin"}),o("inventory.assigning")]}):a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4"}),o("inventory.assignSpool")]})})]})]}),C.isError&&a.jsx("div",{className:"mx-4 mb-4 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:C.error.message})]})]}),g&&s&&m&&k&&(()=>{let oe="";return k.type==="material"?oe=o("inventory.assignMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location}):k.type==="partial"?oe=o("inventory.assignPartialMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location}):k.type==="material_profile"?oe=`${o("inventory.assignMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location})} + `})]})]})}function Tae({isOpen:t,onClose:e,tagUid:n,trayUuid:r,printerId:i,amsId:s,trayId:o}){const{t:l}=Rt(),c=hn(),{showToast:d}=xn(),[u,m]=w.useState(""),p=r||n,{data:f,isLoading:y}=Ze({queryKey:["unlinked-spools"],queryFn:pe.getUnlinkedSpools,enabled:t}),v=w.useMemo(()=>f?f.filter(g=>{if(!u)return!0;const _=u.toLowerCase();return g.filament_name&&g.filament_name.toLowerCase().includes(_)||g.filament_vendor&&g.filament_vendor.toLowerCase().includes(_)||g.filament_material&&g.filament_material.toLowerCase().includes(_)||String(g.id).includes(_)}):[],[f,u]),b=lt({mutationFn:g=>pe.linkSpool(g,{spoolTag:p,printerId:i,amsId:s,trayId:o}),onSuccess:()=>{c.invalidateQueries({queryKey:["unlinked-spools"]}),c.invalidateQueries({queryKey:["linked-spools"]}),d(l("spoolman.linkSuccess"),"success"),e()},onError:g=>{d(g.message||l("spoolman.linkFailed"),"error")}});return t?a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),a.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl shadow-xl w-full max-w-md mx-4 max-h-[80vh] flex flex-col border border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/10",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[a.jsx(ty,{className:"w-5 h-5 text-bambu-green"}),l("spoolman.selectSpool")]}),a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["AMS ",s," T",o," · Printer #",i]})]}),a.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:a.jsx(qt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 border-b border-white/10",children:[a.jsxs("div",{className:"relative",children:[a.jsx(_r,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),a.jsx("input",{type:"text",value:u,onChange:g=>m(g.target.value),placeholder:l("inventory.searchSpools"),className:"w-full pl-9 pr-3 py-2 bg-bambu-dark rounded-lg border border-white/10 text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green"})]}),(r||n)&&a.jsxs("p",{className:"text-xs text-bambu-gray mt-2 font-mono truncate",title:r||n,children:["Tag: ",r||n]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:y?a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):v.length===0?a.jsx("p",{className:"text-center text-bambu-gray py-8 text-sm",children:l("inventory.noSpoolsMatch")}):v.map(g=>a.jsxs("button",{onClick:()=>b.mutate(g.id),disabled:b.isPending||!p,className:"w-full flex items-center gap-3 p-3 rounded-lg hover:bg-white/5 transition-colors text-left",children:[a.jsx("span",{className:"w-6 h-6 rounded-full border border-black/20 flex-shrink-0",style:{backgroundColor:g.filament_color_hex?`#${g.filament_color_hex}`:"#808080"}}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm text-white font-medium truncate",children:g.filament_name||l("spoolman.spoolId")}),a.jsxs("div",{className:"text-xs text-bambu-gray truncate",children:[g.filament_vendor?`${g.filament_vendor} · `:"",g.filament_material||"Unknown"," · #",g.id]})]}),a.jsx("span",{className:"text-xs text-bambu-gray",children:g.remaining_weight!=null?`${Math.round(g.remaining_weight)}g`:"—"})]},g.id))}),a.jsx("div",{className:"p-4 border-t border-white/10 flex justify-end",children:a.jsx(Ie,{variant:"ghost",onClick:e,children:l("inventory.cancel")||"Cancel"})})]})]}):null}function Aae({isOpen:t,onClose:e,printerId:n,amsId:r,trayId:i,trayInfo:s}){const{t:o}=Rt(),l=hn(),{showToast:c}=xn(),[d,u]=w.useState(!1),[m,p]=w.useState(null);w.useEffect(()=>{p(null)},[d]);const[f,y]=w.useState(""),[v,b]=w.useState(null),[g,_]=w.useState(!1),[k,P]=w.useState(null);w.useEffect(()=>{t&&u(!1)},[t]);const{data:N,isLoading:M}=Ze({queryKey:["inventory-spools"],queryFn:()=>pe.getSpools(),enabled:t}),{data:T}=Ze({queryKey:["spool-assignments"],queryFn:()=>pe.getAssignments(),enabled:t}),{data:A}=Ze({queryKey:["settings"],queryFn:()=>pe.getSettings(),enabled:t}),C=lt({mutationFn:oe=>pe.assignSpool({spool_id:oe,printer_id:n,ams_id:r,tray_id:i}),onSuccess:oe=>{l.setQueryData(["spool-assignments"],ue=>{const K=(ue||[]).filter(ae=>!(ae.printer_id===n&&ae.ams_id===r&&ae.tray_id===i));return K.push(oe),K}),l.invalidateQueries({queryKey:["spool-assignments"]}),c(o("inventory.assignSuccess"),"success"),_(!1),b(null),P(null),e()},onError:oe=>{c(`${o("inventory.assignFailed")}: ${oe.message}`,"error")}}),F=oe=>(oe??"").trim().toUpperCase(),V=(oe,ue)=>{const K=F(oe),ae=F(ue);return!K||!ae?"none":K===ae?"exact":ae.includes(K)||K.includes(ae)?"partial":"none"},I=(oe,ue)=>{const K=F(oe),ae=F(ue);return!K||!ae?!1:K===ae};if(!t)return null;const Y=new Set((T||[]).filter(oe=>!(oe.printer_id===n&&oe.ams_id===r&&oe.tray_id===i)).map(oe=>oe.spool_id)),L=r===254||r===255,ne=N?.filter(oe=>!Y.has(oe.id)&&(L||!oe.tag_uid&&!oe.tray_uuid));let ie=ne;if(!d&&(s?.profile||s?.type)){const oe=F(s.profile||s.type);ie=ie?.filter(ue=>{const K=F(ue.slicer_filament_name||ue.slicer_filament);return oe&&K&&K===oe})}if(f&&ie){const oe=f.toLowerCase();ie=ie.filter(ue=>ue.material.toLowerCase().includes(oe)||(ue.brand?.toLowerCase().includes(oe)??!1)||(ue.color_name?.toLowerCase().includes(oe)??!1)||(ue.subtype?.toLowerCase().includes(oe)??!1))}const ee=()=>{if(!m)return;const oe=N?.find(ue=>ue.id===m);if(!oe){c(o("inventory.assignFailed"),"error");return}if(!A?.disable_filament_warnings&&s){const ue=s.material||s.type,K=V(oe.material,ue),ae=oe.slicer_filament_name||oe.slicer_filament,ce=s.profile||s.type,ye=I(ae,ce);if(K!=="exact"||!ye){let Ne="profile";K==="none"&&!ye?Ne="material_profile":K==="partial"&&!ye?Ne="partial_profile":K==="none"?Ne="material":K==="partial"&&(Ne="partial"),b(m),P({type:Ne,spoolMaterial:oe.material||"",trayMaterial:ue||"",spoolProfile:ae||void 0,trayProfile:ce||void 0}),_(!0);return}}C.mutate(m)},de=()=>{v&&(C.mutate(v),_(!1),b(null))};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start sm:items-center justify-center p-4 overflow-y-auto",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),a.jsxs("div",{className:"relative w-full max-w-2xl bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] overflow-hidden flex flex-col my-auto",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ta,{className:"w-5 h-5 text-bambu-green"}),a.jsx("h2",{className:"text-lg font-semibold text-white",children:o("inventory.assignSpool")})]}),a.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:a.jsx(qt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto",children:[s&&a.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[a.jsxs("p",{className:"text-xs text-bambu-gray mb-1",children:[o("inventory.selectSpool"),":"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s.color&&a.jsx("span",{className:"w-4 h-4 rounded-full border border-black/20",style:{backgroundColor:`#${s.color}`}}),a.jsx("span",{className:"text-white font-medium",children:s.type||o("ams.emptySlot")}),a.jsxs("span",{className:"text-bambu-gray",children:["(",s.location,")"]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(_r,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),a.jsx("input",{type:"text",value:f,onChange:oe=>y(oe.target.value),placeholder:o("inventory.searchSpools"),className:"w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green"})]}),a.jsx("div",{children:M?a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):ie&&ie.length>0?a.jsx("div",{className:"max-h-96 overflow-y-auto grid grid-cols-2 sm:grid-cols-3 gap-2",children:ie.map(oe=>a.jsxs("button",{onClick:()=>p(oe.id),title:oe.note||void 0,className:`p-2.5 rounded-lg border text-left transition-colors ${m===oe.id?"bg-bambu-green/20 border-bambu-green":"bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:[a.jsxs("p",{className:"text-white text-sm font-medium truncate",children:[oe.brand?`${oe.brand} `:"",oe.material,oe.subtype?` ${oe.subtype}`:""]}),a.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[oe.rgba&&a.jsx("span",{className:"w-3 h-3 rounded-full border border-black/20 flex-shrink-0",style:{backgroundColor:`#${oe.rgba.substring(0,6)}`}}),a.jsx("span",{className:"text-xs text-bambu-gray truncate",children:oe.color_name||""})]}),oe.label_weight&&a.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[Math.max(0,Math.round(oe.label_weight-oe.weight_used))," / ",oe.label_weight,"g"]})]},oe.id))}):ne&&ne.length===0?a.jsx("div",{className:"text-center py-8 text-bambu-gray",children:a.jsx("p",{children:o("inventory.noManualSpools")})}):a.jsx("div",{className:"text-center py-8 text-bambu-gray",children:a.jsx("p",{children:o("inventory.noSpoolsMatch")})})})]}),a.jsxs("div",{className:"flex justify-between items-center p-4 border-t border-bambu-dark-tertiary",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"disable-filtering-toggle",type:"checkbox",checked:d,onChange:()=>u(oe=>!oe),className:"accent-bambu-green w-4 h-4 rounded focus:ring-0 border-bambu-dark-tertiary"}),a.jsx("label",{htmlFor:"disable-filtering-toggle",className:"text-xs text-bambu-gray select-none cursor-pointer",children:o("inventory.showAllSpools")})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Ie,{variant:"secondary",onClick:e,children:o("common.cancel")}),a.jsx(Ie,{onClick:ee,disabled:!m||C.isPending,children:C.isPending?a.jsxs(a.Fragment,{children:[a.jsx(ct,{className:"w-4 h-4 animate-spin"}),o("inventory.assigning")]}):a.jsxs(a.Fragment,{children:[a.jsx(Ta,{className:"w-4 h-4"}),o("inventory.assignSpool")]})})]})]}),C.isError&&a.jsx("div",{className:"mx-4 mb-4 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:C.error.message})]})]}),g&&s&&m&&k&&(()=>{let oe="";return k.type==="material"?oe=o("inventory.assignMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location}):k.type==="partial"?oe=o("inventory.assignPartialMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location}):k.type==="material_profile"?oe=`${o("inventory.assignMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location})} ${o("inventory.assignProfileMismatchMessage",{spoolProfile:k.spoolProfile||o("common.unknown"),trayProfile:k.trayProfile||o("common.unknown"),location:s.location})}`:k.type==="partial_profile"?oe=`${o("inventory.assignPartialMismatchMessage",{spoolMaterial:k.spoolMaterial,trayMaterial:k.trayMaterial,location:s.location})} diff --git a/static/index.html b/static/index.html index 052ce4549..5cbec43e5 100644 --- a/static/index.html +++ b/static/index.html @@ -23,7 +23,7 @@ - +