_N_E=(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[45],{"5UTg":function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/orders",function(){return t("Jphj")}])},Jphj:function(e,r,t){"use strict";t.r(r);var n=t("wx14"),a=t("q1tI"),l=t.n(a),o=t("yE/o"),u=t("gaPq"),i=t("h4VS"),c=t("Ff2n"),s=t("eHHv"),d=t("sWYD"),f=t("lTCR"),b=t.n(f),p=t("ikXu"),h=t("YFqc"),m=t.n(h),w=t("YRLc"),O=t("mFe8"),g=l.a.createElement;function j(){var e=Object(i.a)(["\n      query orders($offset: Int, $limit: Int, $isShowCarts: Boolean) {\n        orders(offset: $offset, limit: $limit, includeCarts: $isShowCarts) {\n          _id\n          ordered\n          orderNumber\n          status\n          user {\n            _id\n            name\n          }\n          total {\n            amount\n            currency\n          }\n        }\n      }\n    "]);return j=function(){return e},e}var y=Object(s.a)(Object(s.h)("isShowCarts","setShowCarts",!1),Object(w.b)({queryName:"orders",query:b()(j())}),Object(s.f)({toggleShowCarts:function(e){var r=e.updateHasMore,t=e.isShowCarts,n=e.setShowCarts;return function(){n(!t),r(!0)}}}))((function(e){var r=e.isShowCarts,t=e.toggleShowCarts,a=(e.loading,e.updateHasMore,e.setShowCarts,Object(c.a)(e,["isShowCarts","toggleShowCarts","loading","updateHasMore","setShowCarts"]));return g(w.a,Object(n.a)({},a,{cols:5,createPath:null,rowRenderer:function(e){return g(p.a.Row,{key:e._id},g(p.a.Cell,null,e.ordered?Object(d.default)(e.ordered,"Pp"):"n/a"),g(p.a.Cell,null,g(m.a,{href:"/orders/view?_id=".concat(e._id)},g("a",{href:"/orders/view?_id=".concat(e._id)},e.orderNumber?g(l.a.Fragment,null,g("b",null,e.orderNumber),g("small",null,"\xa0(",e._id,")")):g(l.a.Fragment,null,g("b",null,"Cart"),g("small",null,"\xa0(",e._id,")"))))),g(p.a.Cell,null,e.user&&(e.user.name||e.user._id)),g(p.a.Cell,null,g(O.a,{money:e.total})),g(p.a.Cell,null,e.status))}}),g(p.a.Row,null,g(p.a.HeaderCell,{colSpan:5},"Show carts? \xa0",g("input",{type:"checkbox",checked:r,onChange:t}))),g(p.a.Row,null,g(p.a.HeaderCell,null,"Order date"),g(p.a.HeaderCell,null,"Order #"),g(p.a.HeaderCell,null,"User"),g(p.a.HeaderCell,null,"Total"),g(p.a.HeaderCell,null,"Status")))})),C=t("PZVx"),v=l.a.createElement;r.default=Object(C.a)((function(e){var r=Object(n.a)({},e);return v(u.a,r,v(o.a,null,v("h2",null,"Orders"),v(y,null)))}))},YRLc:function(e,r,t){"use strict";t.d(r,"b",(function(){return y}));var n=t("KQm4"),a=t("rePB"),l=t("wx14"),o=t("Ff2n"),u=t("eHHv"),i=t("0dmp"),c=t("q1tI"),s=t.n(c),d=t("ikXu"),f=t("QetY"),b=t("D1pA"),p=t("RotF"),h=t.n(p),m=t("YFqc"),w=t.n(m),O=s.a.createElement;function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function j(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?g(Object(t),!0).forEach((function(r){Object(a.a)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}r.a=function(e){var r=e.items,t=e.cols,n=void 0===t?4:t,a=e.rowRenderer,u=e.createPath,i=(e.data,e.children),c=e.loadMoreEntries,s=(e.loading,e.limit),p=Object(o.a)(e,["items","cols","rowRenderer","createPath","data","children","loadMoreEntries","loading","limit"]);return O(d.a,Object(l.a)({celled:!0},p),O(d.a.Header,null,O(d.a.Row,null,O(d.a.HeaderCell,{colSpan:n},u&&O(w.a,{href:u},O(f.a,{floated:"right",icon:!0,labelPosition:"left",primary:!0,size:"small",href:u},O(b.a,{name:"plus"}),"Add")))),i),r&&O(h.a,{pageStart:0,element:"tbody",loadMore:c,hasMore:null===s||void 0===s||s},r.map(a)),O(d.a.Footer,{fullWidth:!0},O(d.a.Row,null,O(d.a.HeaderCell,{colSpan:n},u&&O(w.a,{href:u},O(f.a,{floated:"right",icon:!0,labelPosition:"left",primary:!0,size:"small",href:u},O(b.a,{name:"plus"})," Add"))))))};var y=function(e){var r=e.query,t=e.queryName,l=e.itemsPerPage,c=void 0===l?5:l;return Object(u.a)(Object(i.a)(r,{options:function(e){var r=e.queryOptions,t=Object(o.a)(e,["queryOptions"]);return j({variables:j({offset:0,limit:c},t)},r)},props:function(e){var r=e.data,l=r.loading,u=r.fetchMore,i=r.stopPolling,c=Object(o.a)(r,["loading","fetchMore","stopPolling"]);return{loading:l,items:c[t],loadMoreEntries:function(){return i(),u({variables:{offset:c[t].length},updateQuery:function(e,r){var l=r.fetchMoreResult;return l?j(j({},e),{},Object(a.a)({},t,[].concat(Object(n.a)(e[t]),Object(n.a)(l[t])))):e}})}}}}))}},mFe8:function(e,r,t){"use strict";var n=t("q1tI"),a=t.n(n).a.createElement;r.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.money,t=void 0===r?{amount:0,currency:"CHF"}:r;return a("span",null,t&&Intl.NumberFormat([],{style:"currency",currency:t.currency}).format(t.amount/100))}}},[["5UTg",0,2,5,1,3,4,7,8]]]);