UNPKG

ebm_customer_meal_app

Version:

*Looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)*

3 lines (2 loc) 17.5 kB
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function l(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function c(t,e){t.appendChild(e)}function u(t,e,n){t.insertBefore(e,n||null)}function a(t){t.parentNode.removeChild(t)}function d(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function i(t){return document.createElement(t)}function s(t){return document.createTextNode(t)}function f(){return s(" ")}function p(){return s("")}function m(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function h(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function g(t,e){e=""+e,t.data!==e&&(t.data=e)}let b;function y(t){b=t}function k(){if(!b)throw new Error("Function called outside component initialization");return b}const $=[],_=[],v=[],x=[],M=Promise.resolve();let N=!1;function O(t){v.push(t)}let w=!1;const I=new Set;function C(){if(!w){w=!0;do{for(let t=0;t<$.length;t+=1){const e=$[t];y(e),P(e.$$)}for($.length=0;_.length;)_.pop()();for(let t=0;t<v.length;t+=1){const e=v[t];I.has(e)||(I.add(e),e())}v.length=0}while($.length);for(;x.length;)x.pop()();N=!1,w=!1,I.clear()}}function P(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(O)}}const D=new Set;let E;function S(){E={r:0,c:[],p:E}}function L(){E.r||r(E.c),E=E.p}function T(t,e){t&&t.i&&(D.delete(t),t.i(e))}function A(t,e,n,r){if(t&&t.o){if(D.has(t))return;D.add(t),E.c.push(()=>{D.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function B(t,e){const n=e.token={};function r(t,r,o,l){if(e.token!==n)return;e.resolved=l;let c=e.ctx;void 0!==o&&(c=c.slice(),c[o]=l);const u=t&&(e.current=t)(c);let a=!1;e.block&&(e.blocks?e.blocks.forEach((t,n)=>{n!==r&&t&&(S(),A(t,1,1,()=>{e.blocks[n]=null}),L())}):e.block.d(1),u.c(),T(u,1),u.m(e.mount(),e.anchor),a=!0),e.block=u,e.blocks&&(e.blocks[r]=u),a&&C()}if((o=t)&&"object"==typeof o&&"function"==typeof o.then){const n=k();if(t.then(t=>{y(n),r(e.then,1,e.value,t),y(null)},t=>{y(n),r(e.catch,2,e.error,t),y(null)}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}var o}function j(t,e){t.d(1),e.delete(t.key)}function Q(t,e,n,r,o,l,c,u,a,d,i,s){let f=t.length,p=l.length,m=f;const h={};for(;m--;)h[t[m].key]=m;const g=[],b=new Map,y=new Map;for(m=p;m--;){const t=s(o,l,m),u=n(t);let a=c.get(u);a?r&&a.p(t,e):(a=d(u,t),a.c()),b.set(u,g[m]=a),u in h&&y.set(u,Math.abs(m-h[u]))}const k=new Set,$=new Set;function _(t){T(t,1),t.m(u,i,c.has(t.key)),c.set(t.key,t),i=t.first,p--}for(;f&&p;){const e=g[p-1],n=t[f-1],r=e.key,o=n.key;e===n?(i=e.first,f--,p--):b.has(o)?!c.has(r)||k.has(r)?_(e):$.has(o)?f--:y.get(r)>y.get(o)?($.add(r),_(e)):(k.add(o),f--):(a(n,c),f--)}for(;f--;){const e=t[f];b.has(e.key)||a(e,c)}for(;p;)_(g[p-1]);return g}function H(t){t&&t.c()}function q(t,n,l){const{fragment:c,on_mount:u,on_destroy:a,after_update:d}=t.$$;c&&c.m(n,l),O(()=>{const n=u.map(e).filter(o);a?a.push(...n):r(n),t.$$.on_mount=[]}),d.forEach(O)}function R(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function z(t,e){-1===t.$$.dirty[0]&&($.push(t),N||(N=!0,M.then(C)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function F(e,o,l,c,u,d,i=[-1]){const s=b;y(e);const f=o.props||{},p=e.$$={fragment:null,ctx:null,props:d,update:t,not_equal:u,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(s?s.$$.context:[]),callbacks:n(),dirty:i};let m=!1;if(p.ctx=l?l(e,f,(t,n,...r)=>{const o=r.length?r[0]:n;return p.ctx&&u(p.ctx[t],p.ctx[t]=o)&&(p.bound[t]&&p.bound[t](o),m&&z(e,t)),n}):[],p.update(),m=!0,r(p.before_update),p.fragment=!!c&&c(p.ctx),o.target){if(o.hydrate){const t=function(t){return Array.from(t.childNodes)}(o.target);p.fragment&&p.fragment.l(t),t.forEach(a)}else p.fragment&&p.fragment.c();o.intro&&T(e.$$.fragment),q(e,o.target,o.anchor),C()}y(s)}class J{$destroy(){R(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}function U(t,e,n){const r=t.slice();return r[27]=e[n],r[29]=n,r}function Y(t,e,n){const r=t.slice();return r[24]=e[n],r[26]=n,r}function G(t,e,n){const r=t.slice();return r[27]=e[n],r[29]=n,r}function K(t,e,n){const r=t.slice();return r[24]=e[n],r[26]=n,r}function V(t,e,n){const r=t.slice();return r[24]=e[n],r[26]=n,r}function W(t){let e,n,o,l,d,s,p,h,g,b,y,k,$,_=[],v=new Map,x=t[3];const M=t=>t[24].Prod_ID;for(let e=0;e<x.length;e+=1){let n=V(t,x,e),r=M(n);v.set(r,_[e]=X(r,n))}return{c(){e=i("h3"),e.textContent="You Have Selected:",n=f(),o=i("table"),l=i("thead"),l.innerHTML="<tr><td>Meal Name</td> \n <td>Qty</td> \n <td>Remove</td></tr>",d=f();for(let t=0;t<_.length;t+=1)_[t].c();s=f(),p=i("div"),h=i("br"),g=f(),b=i("button"),b.textContent="Reset Order",y=f(),k=i("button"),k.textContent="Submit Order"},m(a,i,f){u(a,e,i),u(a,n,i),u(a,o,i),c(o,l),c(o,d);for(let t=0;t<_.length;t+=1)_[t].m(o,null);u(a,s,i),u(a,p,i),c(p,h),c(p,g),c(p,b),c(p,y),c(p,k),f&&r($),$=[m(b,"click",t[18]),m(k,"click",t[19])]},p(t,e){if(520&e[0]){const n=t[3];_=Q(_,e,M,1,t,n,v,o,j,X,null,V)}},d(t){t&&a(e),t&&a(n),t&&a(o);for(let t=0;t<_.length;t+=1)_[t].d();t&&a(s),t&&a(p),r($)}}}function X(t,e){let n,r,o,l,d,p,h,b,y,k,$,_=e[24].Prod_Name+"",v=e[24].Prod_Qty+"";function x(...t){return e[17](e[24],...t)}return{key:t,first:null,c(){n=i("tr"),r=i("td"),o=s(_),l=f(),d=i("td"),p=s(v),h=f(),b=i("td"),y=i("button"),y.textContent="x",k=f(),this.first=n},m(t,e,a){u(t,n,e),c(n,r),c(r,o),c(n,l),c(n,d),c(d,p),c(n,h),c(n,b),c(b,y),c(n,k),a&&$(),$=m(y,"click",x)},p(t,n){e=t,8&n[0]&&_!==(_=e[24].Prod_Name+"")&&g(o,_),8&n[0]&&v!==(v=e[24].Prod_Qty+"")&&g(p,v)},d(t){t&&a(n),$()}}}function Z(e){return{c:t,m:t,p:t,d:t}}function tt(t){let e,n,r=t[1]>0&&et(t),o=t[2]>0&&ot(t);return{c(){r&&r.c(),e=f(),o&&o.c(),n=p()},m(t,l){r&&r.m(t,l),u(t,e,l),o&&o.m(t,l),u(t,n,l)},p(t,l){t[1]>0?r?r.p(t,l):(r=et(t),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null),t[2]>0?o?o.p(t,l):(o=ot(t),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null)},d(t){r&&r.d(t),t&&a(e),o&&o.d(t),t&&a(n)}}}function et(t){let e,n,r,o,l,d=[],s=new Map,p=t[22].products;const m=t=>t[24].id;for(let e=0;e<p.length;e+=1){let n=K(t,p,e),r=m(n);s.set(r,d[e]=rt(r,n))}return{c(){e=i("h2"),e.textContent="Breakfast Meals",n=f(),r=i("table"),o=i("thead"),o.innerHTML="<tr><td>Meal Name</td> \n <td>Qty</td></tr>",l=f();for(let t=0;t<d.length;t+=1)d[t].c()},m(t,a){u(t,e,a),u(t,n,a),u(t,r,a),c(r,o),c(r,l);for(let t=0;t<d.length;t+=1)d[t].m(r,null)},p(t,e){if(321&e[0]){const n=t[22].products;d=Q(d,e,m,1,t,n,s,r,j,rt,null,K)}},d(t){t&&a(e),t&&a(n),t&&a(r);for(let t=0;t<d.length;t+=1)d[t].d()}}}function nt(e){let n,r,o,l=e[29]+1+"";return{c(){n=i("option"),r=s(l),n.__value=o=e[29]+1,n.value=n.__value,h(n,"class","option")},m(t,e){u(t,n,e),c(n,r)},p:t,d(t){t&&a(n)}}}function rt(t,e){let n,r,o=e[24].tags.includes("Breakfast"),l=o&&function(t){let e,n,r,o,l,p,g,b,y,k,$,_=t[24].title+"",v=Array(t[0]),x=[];for(let e=0;e<v.length;e+=1)x[e]=nt(G(t,v,e));function M(...e){return t[20](t[24],...e)}return{c(){e=i("tr"),n=i("td"),r=s(_),o=f(),l=i("td"),p=i("select"),g=i("option");for(let t=0;t<x.length;t+=1)x[t].c();y=f(),g.__value="0",g.value=g.__value,h(p,"name",b=t[24].id),h(e,"id",k=t[24].id)},m(t,a,d){u(t,e,a),c(e,n),c(n,r),c(e,o),c(e,l),c(l,p),c(p,g);for(let t=0;t<x.length;t+=1)x[t].m(p,null);c(e,y),d&&$(),$=m(p,"change",M)},p(e,n){if(t=e,1&n[0]){let e;for(v=Array(t[0]),e=0;e<v.length;e+=1){const r=G(t,v,e);x[e]?x[e].p(r,n):(x[e]=nt(r),x[e].c(),x[e].m(p,null))}for(;e<x.length;e+=1)x[e].d(1);x.length=v.length}},d(t){t&&a(e),d(x,t),$()}}}(e);return{key:t,first:null,c(){n=p(),l&&l.c(),r=p(),this.first=n},m(t,e){u(t,n,e),l&&l.m(t,e),u(t,r,e)},p(t,e){o&&l.p(t,e)},d(t){t&&a(n),l&&l.d(t),t&&a(r)}}}function ot(t){let e,n,r,o,l,d=[],s=new Map,p=t[22].products;const m=t=>t[24].id;for(let e=0;e<p.length;e+=1){let n=Y(t,p,e),r=m(n);s.set(r,d[e]=ct(r,n))}return{c(){e=i("h2"),e.textContent="Lunch/Dinner Meals",n=f(),r=i("table"),o=i("thead"),o.innerHTML="<tr><td>Meal Name</td> \n <td>Qty</td></tr>",l=f();for(let t=0;t<d.length;t+=1)d[t].c()},m(t,a){u(t,e,a),u(t,n,a),u(t,r,a),c(r,o),c(r,l);for(let t=0;t<d.length;t+=1)d[t].m(r,null)},p(t,e){if(321&e[0]){const n=t[22].products;d=Q(d,e,m,1,t,n,s,r,j,ct,null,Y)}},d(t){t&&a(e),t&&a(n),t&&a(r);for(let t=0;t<d.length;t+=1)d[t].d()}}}function lt(e){let n,r,o,l=e[29]+1+"";return{c(){n=i("option"),r=s(l),n.__value=o=e[29]+1,n.value=n.__value,h(n,"class","option")},m(t,e){u(t,n,e),c(n,r)},p:t,d(t){t&&a(n)}}}function ct(t,e){let n,r,o=e[24].tags.includes("Lunch/Dinner"),l=o&&function(t){let e,n,r,o,l,p,g,b,y,k,$,_=t[24].title+"",v=Array(t[0]),x=[];for(let e=0;e<v.length;e+=1)x[e]=lt(U(t,v,e));function M(...e){return t[21](t[24],...e)}return{c(){e=i("tr"),n=i("td"),r=s(_),o=f(),l=i("td"),p=i("select"),g=i("option");for(let t=0;t<x.length;t+=1)x[t].c();y=f(),g.__value="0",g.value=g.__value,h(p,"name",b=t[24].id),h(e,"id",k=t[24].id)},m(t,a,d){u(t,e,a),c(e,n),c(n,r),c(e,o),c(e,l),c(l,p),c(p,g);for(let t=0;t<x.length;t+=1)x[t].m(p,null);c(e,y),d&&$(),$=m(p,"change",M)},p(e,n){if(t=e,1&n[0]){let e;for(v=Array(t[0]),e=0;e<v.length;e+=1){const r=U(t,v,e);x[e]?x[e].p(r,n):(x[e]=lt(r),x[e].c(),x[e].m(p,null))}for(;e<x.length;e+=1)x[e].d(1);x.length=v.length}},d(t){t&&a(e),d(x,t),$()}}}(e);return{key:t,first:null,c(){n=p(),l&&l.c(),r=p(),this.first=n},m(t,e){u(t,n,e),l&&l.m(t,e),u(t,r,e)},p(t,e){o&&l.p(t,e)},d(t){t&&a(n),l&&l.d(t),t&&a(r)}}}function ut(e){let n;return{c(){n=i("p"),n.textContent="loading products"},m(t,e){u(t,n,e)},p:t,d(t){t&&a(n)}}}function at(e){let n,r,o,l,d,m,h,b,y,k,$,_=e[3].length&&W(e),v={ctx:e,current:null,token:null,pending:ut,then:tt,catch:Z,value:22,error:23};return B($=e[6],v),{c(){n=i("hr"),r=f(),o=i("h2"),l=s("Number of Selected Meals "),d=s(e[4]),m=f(),_&&_.c(),h=f(),b=i("br"),y=f(),k=p(),v.block.c()},m(t,e){u(t,n,e),u(t,r,e),u(t,o,e),c(o,l),c(o,d),u(t,m,e),_&&_.m(t,e),u(t,h,e),u(t,b,e),u(t,y,e),u(t,k,e),v.block.m(t,v.anchor=e),v.mount=()=>k.parentNode,v.anchor=k},p(t,n){e=t,16&n[0]&&g(d,e[4]),e[3].length?_?_.p(e,n):(_=W(e),_.c(),_.m(h.parentNode,h)):_&&(_.d(1),_=null);{const t=e.slice();t[22]=v.resolved,v.block.p(t,n)}},i:t,o:t,d(t){t&&a(n),t&&a(r),t&&a(o),t&&a(m),_&&_.d(t),t&&a(h),t&&a(b),t&&a(y),t&&a(k),v.block.d(t),v.token=null,v=null}}}function dt(t,e,n){let{brk:r}=e,{lun:o}=e,{id:l}=e,{days:c}=e,{carb:u}=e,{availableMeals:a}=e;const d=fetch("http://localhost:5001/shop-products").then(t=>t.json());let i={OrderInfo:{OrderID:l,NumBrk:r,NumLD:o,NumDays:c,NoCarbs:u}},s=[],f={};const p=(t,e,r)=>{let o={};if(o.Prod_ID=t,o.Prod_Name=e,o.Prod_Qty=r,n(15,f[e]=parseInt(r),f),n(3,s=[...s,o]),y.includes(t)){let e=s.filter(e=>e.Prod_ID!==t);n(3,s=[...e,o])}if("0"===r){let e=s.filter(e=>e.Prod_ID!==t);n(3,s=e)}document.getElementById(t).style.display="none"},m=(t,e)=>{let r=s.filter(e=>e.Prod_ID!==t);n(3,s=r),document.getElementById(t).value="",delete f[e],document.getElementById(t).style.display="block"},h=t=>{t.Products=s},g=t=>{n(3,s=[]),t.forEach(t=>{let e=document.getElementById(t);e.style.display="block",e.value=""}),n(15,f={})};let b,y;return t.$set=t=>{"brk"in t&&n(1,r=t.brk),"lun"in t&&n(2,o=t.lun),"id"in t&&n(12,l=t.id),"days"in t&&n(13,c=t.days),"carb"in t&&n(14,u=t.carb),"availableMeals"in t&&n(0,a=t.availableMeals)},t.$$.update=()=>{32776&t.$$.dirty[0]&&n(4,b=s.length?Object.values(f).reduce((t,e)=>t+e):0),8&t.$$.dirty[0]&&n(5,y=s.length?s.map(t=>t.Prod_ID):[]),8214&t.$$.dirty[0]&&n(0,a=(o+r)*c-b)},[a,r,o,s,b,y,d,i,p,m,h,g,l,c,u,f,t=>{const e=JSON.stringify(t);fetch("http://localhost:5001/send",{method:"POST",headers:{"Content-Type":"application/json"},body:e,redirect:"follow"}).then(t=>{console.log(t)}).catch(t=>console.log(t))},t=>m(t.Prod_ID,t.Prod_Name),()=>g(y),()=>{h(i),console.log(i)},(t,e)=>{p(t.id,t.title,e.target.value)},(t,e)=>{p(t.id,t.title,e.target.value)}]}class it extends J{constructor(t){super(),F(this,t,dt,at,l,{brk:1,lun:2,id:12,days:13,carb:14,availableMeals:0},[-1,-1])}}function st(t){let e;return{c(){e=i("p"),e.textContent="No Carb Order"},m(t,n){u(t,e,n)},d(t){t&&a(e)}}}function ft(t){let e,n,r,o,l,d,p,m,h,b,y,k,$,_,v,x,M,N,O,w,I,C,P,D,E=""!==t[4]&&st();const S=new it({props:{id:t[0],brk:t[1],lun:t[2],days:t[3],carb:t[4],availableMeals:t[5]}});return{c(){e=i("hr"),n=f(),r=i("h2"),o=s("Please select you meals for order #"),l=s(t[0]),d=f(),p=i("p"),m=s("Total number of meals = "),h=s(t[5]),b=f(),y=i("p"),k=s("Total number of days = "),$=s(t[3]),_=f(),v=i("p"),x=s("Total number of breakfast/day = "),M=s(t[1]),N=f(),O=i("p"),w=s("Total number of lunch/dinner/day = "),I=s(t[2]),C=f(),E&&E.c(),P=f(),H(S.$$.fragment)},m(t,a){u(t,e,a),u(t,n,a),u(t,r,a),c(r,o),c(r,l),u(t,d,a),u(t,p,a),c(p,m),c(p,h),u(t,b,a),u(t,y,a),c(y,k),c(y,$),u(t,_,a),u(t,v,a),c(v,x),c(v,M),u(t,N,a),u(t,O,a),c(O,w),c(O,I),u(t,C,a),E&&E.m(t,a),u(t,P,a),q(S,t,a),D=!0},p(t,[e]){(!D||1&e)&&g(l,t[0]),(!D||32&e)&&g(h,t[5]),(!D||8&e)&&g($,t[3]),(!D||2&e)&&g(M,t[1]),(!D||4&e)&&g(I,t[2]),""!==t[4]?E||(E=st(),E.c(),E.m(P.parentNode,P)):E&&(E.d(1),E=null);const n={};1&e&&(n.id=t[0]),2&e&&(n.brk=t[1]),4&e&&(n.lun=t[2]),8&e&&(n.days=t[3]),16&e&&(n.carb=t[4]),32&e&&(n.availableMeals=t[5]),S.$set(n)},i(t){D||(T(S.$$.fragment,t),D=!0)},o(t){A(S.$$.fragment,t),D=!1},d(t){t&&a(e),t&&a(n),t&&a(r),t&&a(d),t&&a(p),t&&a(b),t&&a(y),t&&a(_),t&&a(v),t&&a(N),t&&a(O),t&&a(C),E&&E.d(t),t&&a(P),R(S,t)}}}function pt(t,e,n){let{id:r=""}=e,{brk:o=0}=e,{lun:l=0}=e,{days:c=0}=e,{carb:u=""}=e,{totalMeals:a=0}=e;return t.$set=t=>{"id"in t&&n(0,r=t.id),"brk"in t&&n(1,o=t.brk),"lun"in t&&n(2,l=t.lun),"days"in t&&n(3,c=t.days),"carb"in t&&n(4,u=t.carb),"totalMeals"in t&&n(5,a=t.totalMeals)},[r,o,l,c,u,a]}class mt extends J{constructor(t){super(),F(this,t,pt,ft,l,{id:0,brk:1,lun:2,days:3,carb:4,totalMeals:5})}}function ht(t,e,n){const r=t.slice();return r[14]=e[n],r[16]=n,r}function gt(e){let n;return{c(){n=i("p"),n.textContent="Error something went wrong"},m(t,e){u(t,n,e)},p:t,d(t){t&&a(n)}}}function bt(t){let e,n=t[12]&&yt(t);return{c(){n&&n.c(),e=p()},m(t,r){n&&n.m(t,r),u(t,e,r)},p(t,r){t[12]?n?n.p(t,r):(n=yt(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&a(e)}}}function yt(t){let e,n,r,o,l=[],d=new Map,s=t[12];const p=t=>t[14].OrderInfo;for(let e=0;e<s.length;e+=1){let n=ht(t,s,e),r=p(n);d.set(r,l[e]=kt(r,n))}return{c(){e=i("table"),n=i("thead"),n.innerHTML="<tr><td>Order Number</td> \n <td>Order Status</td> \n <td>Order Actions</td></tr>",r=f(),o=i("tbody");for(let t=0;t<l.length;t+=1)l[t].c()},m(t,a){u(t,e,a),c(e,n),c(e,r),c(e,o);for(let t=0;t<l.length;t+=1)l[t].m(o,null)},p(t,e){if(514&e){const n=t[12];l=Q(l,e,p,1,t,n,d,o,j,kt,null,ht)}},d(t){t&&a(e);for(let t=0;t<l.length;t+=1)l[t].d()}}}function kt(t,e){let n,r,o,l,d,p,h,b,y,k,$,_=e[14].OrderInfo.OrderID+"",v=e[14].OrderInfo.OrderStatus+"";function x(...t){return e[11](e[14],...t)}return{key:t,first:null,c(){n=i("tr"),r=i("td"),o=s(_),l=f(),d=i("td"),p=s(v),h=f(),b=i("td"),y=i("button"),y.textContent="Update Order",k=f(),this.first=n},m(t,e,a){u(t,n,e),c(n,r),c(r,o),c(n,l),c(n,d),c(d,p),c(n,h),c(n,b),c(b,y),c(n,k),a&&$(),$=m(y,"click",x)},p(t,n){e=t,2&n&&_!==(_=e[14].OrderInfo.OrderID+"")&&g(o,_),2&n&&v!==(v=e[14].OrderInfo.OrderStatus+"")&&g(p,v)},d(t){t&&a(n),$()}}}function $t(e){let n;return{c(){n=i("p"),n.textContent="Loading"},m(t,e){u(t,n,e)},p:t,d(t){t&&a(n)}}}function _t(t){let e;const n=new mt({props:{id:t[3],brk:t[4],lun:t[5],days:t[6],carb:t[8],totalMeals:t[7]}});return{c(){H(n.$$.fragment)},m(t,r){q(n,t,r),e=!0},p(t,e){const r={};8&e&&(r.id=t[3]),16&e&&(r.brk=t[4]),32&e&&(r.lun=t[5]),64&e&&(r.days=t[6]),256&e&&(r.carb=t[8]),128&e&&(r.totalMeals=t[7]),n.$set(r)},i(t){e||(T(n.$$.fragment,t),e=!0)},o(t){A(n.$$.fragment,t),e=!1},d(t){R(n,t)}}}function vt(t){let e,n,r,o,l,d,p,m,h={ctx:t,current:null,token:null,pending:$t,then:bt,catch:gt,value:12,error:13};B(d=t[1],h);let b=t[2]&&_t(t);return{c(){e=i("main"),n=i("h1"),r=s("Customer Number: "),o=s(t[0]),l=f(),h.block.c(),p=f(),b&&b.c()},m(t,a){u(t,e,a),c(e,n),c(n,r),c(n,o),c(e,l),h.block.m(e,h.anchor=null),h.mount=()=>e,h.anchor=p,c(e,p),b&&b.m(e,null),m=!0},p(n,[r]){if(t=n,(!m||1&r)&&g(o,t[0]),h.ctx=t,2&r&&d!==(d=t[1])&&B(d,h));else{const e=t.slice();e[12]=h.resolved,h.block.p(e,r)}t[2]?b?(b.p(t,r),4&r&&T(b,1)):(b=_t(t),b.c(),T(b,1),b.m(e,null)):b&&(S(),A(b,1,1,()=>{b=null}),L())},i(t){m||(T(b),m=!0)},o(t){A(b),m=!1},d(t){t&&a(e),h.block.d(),h.token=null,h=null,b&&b.d()}}}function xt(t,e,n){let r,{customer:o=""}=e,l=!1,c=0,u=0,a=0,d=0,i=0,s="",f="";var p;p=()=>{n(1,r=(async t=>{const e=await fetch("http://localhost:5001/orderinfo/"+t),n=await e.json();return await n.Orders})(o))},k().$$.on_mount.push(p);const m=t=>{const e=t.OrderInfo;n(3,c=e.OrderID),f=e.OrderStatus,n(4,u=e.NumBrk),n(5,a=e.NumLD),n(6,d=e.NumDays),n(8,s=e.NoCarbs),n(7,i=u+a*d),n(2,l=!0),console.log(e)};return t.$set=t=>{"customer"in t&&n(0,o=t.customer)},[o,r,l,c,u,a,d,i,s,m,f,t=>m(t)]}const Mt=document.querySelector("#customer-app"),Nt=Mt.getAttribute("data-customer"),Ot=new class extends J{constructor(t){super(),F(this,t,xt,vt,l,{customer:0})}}({target:Mt,props:{customer:Nt}});return window.app=Ot,Ot}(); //# sourceMappingURL=bundle.js.map