-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex-93d5d67b.js
1 lines (1 loc) · 5.67 KB
/
index-93d5d67b.js
1
(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))l(t);new MutationObserver(t=>{for(const a of t)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&l(s)}).observe(document,{childList:!0,subtree:!0});function d(t){const a={};return t.integrity&&(a.integrity=t.integrity),t.referrerPolicy&&(a.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?a.credentials="include":t.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(t){if(t.ep)return;t.ep=!0;const a=d(t);fetch(t.href,a)}})();document.getElementById("toggle").addEventListener("click",x,!1);document.getElementById("calculate-button").addEventListener("click",C,!1);document.getElementById("calculate-button-outsource").addEventListener("click",P,!1);var b,h,y,f=!0;function P(){typeof y<"u"&&y.destroy();var n=document.getElementById("num-of-boards-outsourcing").value,o=document.getElementById("parts-per-board-outsourcing").value;let d=9+(n-100)/250,l=3/24+n*o/800/24;console.log(l);let t=Math.floor(l/.33)*.66+l;console.log(t);var a=[d,t],s=document.getElementById("outsource-graph");const u={labels:["Outsourced","LumenPnP"],datasets:[{label:"Days",data:a}]};y=new Chart(s,{type:"bar",data:u,options:{indexAxis:"y",plugins:{title:{display:!0,text:"Time to Produce",padding:{top:30,bottom:10},font:{size:20}},legend:{display:!1}},maintainAspectRatio:!0,animations:!1,aspectRatio:2,scales:{y:{display:!0},x:{title:{display:!0,text:"Days"}}}}})}function x(){f?(document.getElementById("hand").style.display="none",document.getElementById("outsource").style.display="block",document.getElementById("toggle").innerHTML="Compare Against Hand Placing Instead",f=!1):(document.getElementById("outsource").style.display="none",document.getElementById("hand").style.display="block",document.getElementById("toggle").innerHTML="Compare Against Outsourcing Instead",f=!0)}document.getElementById("graph-type").onclick=function(){this.checked?(document.getElementById("cost-graph").style.display="block",document.getElementById("time-graph").style.display="none"):(document.getElementById("cost-graph").style.display="none",document.getElementById("time-graph").style.display="block")};function k(n,o){typeof n<"u"&&n.destroy(),typeof o<"u"&&o.destroy()}function v(n,o,d){var l=d*o*n;return l}function B(n,o,d){var l=1995,t=3,a=2.5/60/d,s=l+t*o+a*o*n;return s}function L(n,o){return n/o}function A(n,o,d){if(n<4)return 0;{let l=n-3,t=2.5/60/d,a=o/800,s=t+a;return l/s}}function C(){k(b,h);var n=document.getElementById("operator-rate").value,o=document.getElementById("hand-time").value/60,d=document.getElementById("parts-per-board").value;let l=document.getElementById("boards-per-job").value;for(var t=[],a=[],s=[],e=1,m=!1,u=0;!m&&(a[e-1]=v(e,n,o),t[e-1]=B(e,n,l),s[e-1]=e,a[e-1]>t[e-1]&&(m=!0,u=e),e=e+1,!(e>5e3)););for(;e<u*5&&(a[e-1]=v(e,n,o),t[e-1]=B(e,n,l),s[e-1]=e,e=e+1,!(e>5e3)););console.log("final hand data: "+a),console.log("final lumen data: "+t);const E=document.getElementById("myChart");b=new Chart(E,{type:"line",data:{labels:s,datasets:[{label:"Hand Population",data:a,borderWidth:1},{label:"LumenPnP Population",data:t,borderWidth:1}]},options:{plugins:{tooltip:{callbacks:{label:function(r){let i=r.dataset.label||"";return i&&(i+=": "),r.parsed.y!==null&&(i+=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(r.parsed.y)+" spent to produce "+(r.parsed.x+1)+" boards."),i},title:function(r){return""}}},title:{display:!0,text:"Cost per Board Produced",padding:{top:30,bottom:10},font:{size:20}}},maintainAspectRatio:!0,animations:!1,aspectRatio:2,scales:{y:{title:{display:!0,text:"Total Cost"},display:!0,beginAtZero:!0,ticks:{callback:function(r,i,H){return"$"+r}}},x:{title:{display:!0,text:"Boards Produced"}}}}}),document.getElementById("order").innerHTML="<p>A LumenPnP pays for itself after</p><div class='flipped-point'>"+u+"</div><p>boards produced.</p><br><h2>Questions?</h2><h3>Ask us at <a href='mailto:sales@opulo.io'>sales@opulo.io</a>.</h3> ",document.getElementById("order").style.display="inline-block";for(var c=[],p=[],g=[],e=1;e<41;)p[e-1]=L(e,o),c[e-1]=A(e,d,l),g[e-1]=e,e=e+1;console.log("final hand boards: "+p),console.log("final lumen boards: "+c);const I=document.getElementById("boardsChart");h=new Chart(I,{type:"line",data:{labels:g,datasets:[{label:"Hand Population",data:p,borderWidth:1},{label:"LumenPnP Population",data:c,borderWidth:1}]},options:{plugins:{tooltip:{callbacks:{label:function(r){let i=r.dataset.label||"";return i&&(i+=": "),r.parsed.y!==null&&(i+=r.parsed.y.toFixed(2)+" boards produced after "+(r.parsed.x+1)+" hours"),i},title:function(r){return""}}},title:{display:!0,text:"Boards Produced per Hour",padding:{top:30,bottom:10},font:{size:20}}},maintainAspectRatio:!0,animations:!1,aspectRatio:2,scales:{y:{title:{display:!0,text:"Boards Produced"},display:!0,beginAtZero:!0},x:{title:{display:!0,text:"Hours"}}},tooltips:{callbacks:{label:function(r){return r.yLabel}}}}});var _=(c[39]-c[38])/(p[39]-p[38]);document.getElementById("bph-result").innerHTML="<p>A LumenPnP assembles boards</p><div class='flipped-point'>"+_.toFixed(1)+"x</div><p>faster than hand-placing after setup.</p><br><h2>Questions?</h2><h3>Ask us at <a href='mailto:sales@opulo.io'>sales@opulo.io</a>.</h3> ",document.getElementById("bph-result").style.display="inline-block",document.getElementById("graph-type").checked?(document.getElementById("cost-graph").style.display="block",document.getElementById("time-graph").style.display="none"):(document.getElementById("cost-graph").style.display="none",document.getElementById("time-graph").style.display="block")}