(window.webpackJsonp=window.webpackJsonp||[]).push([[81],{VIoQ:function(e,t,n){"use strict";n.r(t);var a=n("qNsG"),c=n("q1tI"),r=n.n(c),u=n("nOHt"),o=n("eHHv"),i=n("yE/o"),s=n("gaPq"),l=n("zrwo"),p=n("kOwS"),d=n("dfwq"),f=n("rt45"),m=n("lTCR"),b=n.n(m),v=n("4KRT"),O=n("hePV"),j=n.n(O),w=n("gmoh"),y=n.n(w),S=n("fjVX"),E=n.n(S),P=n("oB+O"),_=n.n(P),h=n("7zkD"),T=n("PaXs");function g(){var e=Object(f.a)(["\n    mutation create($product: CreateProductInput!) {\n      createProduct(product: $product) {\n        _id\n      }\n    }\n  "]);return g=function(){return e},e}function q(){var e=Object(f.a)(['\n    query getProductTypes {\n      uniforms: __type(name: "Product") {\n        options: possibleTypes {\n          value: name\n          label: description\n        }\n      }\n    }\n  ']);return q=function(){return e},e}var N=Object(o.a)(Object(v.c)(b()(q())),Object(v.c)(b()(g())),Object(h.a)(function(e){var t=e.data,n=(t=void 0===t?{}:t).uniforms,a=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(d.default)(a.options))}}}}),Object(o.f)({onSubmitSuccess:function(e){var t=e.onSuccess;return function(e){var n=e.data.createProduct;t(n._id)}},onSubmit:function(e){var t=e.mutate,n=e.schema;return function(e){var a=Object(p.a)({},e);return t({variables:{product:n.clean(a)}})}}}),T.a,Object(o.d)(function(e){e.onSuccess,e.mutate;var t=Object(a.a)(e,["onSuccess","mutate"]);return Object(l.a)({},t)}),o.e)(function(e){return r.a.createElement(_.a,e,r.a.createElement(j.a,{name:"title"}),r.a.createElement(j.a,{name:"type"}),r.a.createElement(E.a,null),r.a.createElement(y.a,{value:"Add product",className:"primary"}))}),V=n("PZVx");t.default=Object(V.a)(Object(o.a)(u.withRouter,Object(o.f)({onSuccess:function(e){var t=e.router;return function(e){t.push({pathname:"/products/edit",query:{_id:e}})}}}))(function(e){var t=e.onSuccess,n=Object(a.a)(e,["onSuccess"]);return r.a.createElement(s.a,n,r.a.createElement(i.a,null,r.a.createElement("p",null,"New product"),r.a.createElement(N,{onSuccess:t})))}))},Zofu:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/products/new",function(){var e=n("VIoQ");return{page:e.default||e}}])}},[["Zofu",1,0]]]);