(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{KQm4:function(t,e,n){"use strict";function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n.d(e,"a",(function(){return r}))},VIoQ:function(t,e,n){"use strict";n.r(e);var r=n("Ff2n"),o=n("q1tI"),c=n.n(o),u=n("nOHt"),a=n("eHHv"),i=n("yE/o"),s=n("gaPq"),p=n("rePB"),f=n("wx14"),l=n("KQm4"),b=n("h4VS"),O=n("lTCR"),d=n.n(O),j=n("0dmp"),m=n("hePV"),y=n.n(m),v=n("gmoh"),w=n.n(v),P=n("fjVX"),h=n.n(P),S=n("oB+O"),g=n.n(S),_=n("7zkD"),E=n("PaXs"),T=c.a.createElement;function A(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function V(){var t=Object(b.a)(["\n    mutation create($product: CreateProductInput!) {\n      createProduct(product: $product) {\n        _id\n      }\n    }\n  "]);return V=function(){return t},t}function D(){var t=Object(b.a)(['\n    query getProductTypes {\n      uniforms: __type(name: "Product") {\n        options: possibleTypes {\n          value: name\n          label: description\n        }\n      }\n    }\n  ']);return D=function(){return t},t}var I=Object(a.a)(Object(j.a)(d()(D())),Object(j.a)(d()(V())),Object(_.a)((function(t){var e=t.data,n=(e=void 0===e?{}:e).uniforms,r=void 0===n?{options:[]}:n;return{title:{type:String,optional:!1,label:"Name"},type:{type:String,optional:!1,label:"Type",uniforms:{options:[{label:"Choose Type",value:null}].concat(Object(l.a)(r.options))}}}})),Object(a.f)({onSubmitSuccess:function(t){var e=t.onSuccess;return function(t){var n=t.data.createProduct;e(n._id)}},onSubmit:function(t){var e=t.mutate,n=t.schema;return function(t){var r=Object(f.a)({},t);return e({variables:{product:n.clean(r)}})}}}),E.a,Object(a.d)((function(t){t.onSuccess,t.mutate;return function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?A(Object(n),!0).forEach((function(e){Object(p.a)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},Object(r.a)(t,["onSuccess","mutate"]))})),a.e)((function(t){return T(g.a,t,T(y.a,{name:"title"}),T(y.a,{name:"type"}),T(h.a,null),T(w.a,{value:"Add product",className:"primary"}))})),N=n("PZVx"),k=c.a.createElement;e.default=Object(N.a)(Object(a.a)(u.withRouter,Object(a.f)({onSuccess:function(t){var e=t.router;return function(t){e.push({pathname:"/products/edit",query:{_id:t}})}}}))((function(t){var e=t.onSuccess,n=Object(r.a)(t,["onSuccess"]);return k(s.a,n,k(i.a,null,k("p",null,"New product"),k(I,{onSuccess:e})))})))},Zofu:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/products/new",function(){return n("VIoQ")}])}},[["Zofu",0,2,5,1,3,4,6]]]);