text: (window.webpackJsonp=window.webpackJsonp||[]).push([[42],{"32749efba8616428f6e4":function(e,n,t){"use strict";t.d(n,"e",(function(){return r})),t.d(n,"c",(function(){return i})),t.d(n,"b",(function(){return o})),t.d(n,"a",(function(){return c})),t.d(n,"f",(function(){return u})),t.d(n,"d",(function(){return a}));var a={current:1,next:2,prev:0,take:10,total:0},r=new Array(10).fill("").map((function(e,n){return{key:n}})),i=[{key:"0",value:"createdAt",name:"S\u1eafp theo ng\xe0y t\u1ea1o"},{key:"1",value:"name",name:"S\u1eafp theo Alphabet"}],o=[{key:"all",value:"all",name:"T\u1ea5t c\u1ea3 c\xe1c lo\u1ea1i"},{key:"0",value:0,name:"C\xe2y"},{key:"1",value:1,name:"Lu\u1ed1ng"},{key:"2",value:2,name:"To\xe0n b\u1ed9 v\xf9ng"},{key:"3",value:3,name:"Trang tr\u1ea1i"},{key:"4",value:4,name:"Nh\xe0 k\xednh"},{key:"5",value:5,name:"Kh\xe1c"}],c=[{key:"0",value:"0",name:"C\xe2y"},{key:"1",value:"1",name:"Lu\u1ed1ng"},{key:"2",value:"2",name:"To\xe0n b\u1ed9 v\xf9ng"},{key:"3",value:"3",name:"Trang tr\u1ea1i"},{key:"4",value:"4",name:"Nh\xe0 k\xednh"},{key:"5",value:"5",name:"Kh\xe1c"}],u=[{key:"all",value:"all",name:"T\u1ea5t c\u1ea3 c\xe1c tr\u1ea1ng th\xe1i"},{key:"0",value:0,name:"\u0110ang s\u1ea3n xu\u1ea5t"},{key:"1",value:1,name:"D\u1eebng s\u1ea3n xu\u1ea5t"},{key:"2",value:2,name:"T\u1ea1m d\u1eebng s\u1ea3n xu\u1ea5t"}]},"7689943c05fcdbd4f8f9":function(e,n,t){"use strict";t.r(n),t.d(n,"ProductObjectCreatePage",(function(){return $}));t("501bc7434ef93f928f1c");var a,r=t("2ead291d06c1b64a6501"),i=t.n(r),o=t("8af190b70a6bc55c6f1b"),c=t.n(o),u=t("0b3cb19af78752326f59"),l=(t("8a2d1b95e05b6a321e74"),t("35bade9c1da9447a8e1e")),f=t("d7dd51e1bf6bfc2c9c3d"),d=t("e95a63b25fb92ed15721"),s=t("4dd2a92e69dcbe1bab10"),m=t("789681ddd73af4292062"),h=t("ef33d2abd2226bd257d7"),b=t("2d7c98c4749c62bd9b28"),p=t("7c0ef0afc7a666302909"),v=t("5a0f338de5ba7695af1f"),y=t("e70a7c8f96be2a18ecd2"),g=t("32749efba8616428f6e4"),w=t("08f496cee8caf5366422");function O(e,n,t,r){a||(a="function"===typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103);var i=e&&e.defaultProps,o=arguments.length-3;if(n||0===o||(n={children:void 0}),1===o)n.children=r;else if(o>1){for(var c=new Array(o),u=0;u<o;u++)c[u]=arguments[u+3];n.children=c}if(n&&i)for(var l in i)void 0===n[l]&&(n[l]=i[l]);else n||(n=i||{});return{$$typeof:a,type:e,key:void 0===t?null:""+t,ref:null,props:n,_owner:null}}function k(e,n,t,a,r,i,o){try{var c=e[i](o),u=c.value}catch(e){return void t(e)}c.done?n(u):Promise.resolve(u).then(a,r)}function j(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function x(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){I(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function I(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function D(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var a,r,i=[],o=!0,c=!1;try{for(t=t.call(e);!(o=(a=t.next()).done)&&(i.push(a.value),!n||i.length!==n);o=!0);}catch(e){c=!0,r=e}finally{try{o||null==t.return||t.return()}finally{if(c)throw r}}return i}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return T(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,a=new Array(n);t<n;t++)a[t]=e[t];return a}var C=i.a.useForm,P=u.d.div.withConfig({displayName:"CreatePage__WrapperContainer",componentId:"sc-1wgylx9-0"})(["width:100%;height:auto;background:white;padding:24px 48px;"]),A=u.d.div.withConfig({displayName:"CreatePage__WrapperContent",componentId:"sc-1wgylx9-1"})(["width:100%;height:auto;background:#ffffff;"]),S=u.d.div.withConfig({displayName:"CreatePage__WrapperContentTitle",componentId:"sc-1wgylx9-2"})(["width:100%;height:auto;display:flex;flex-direction:column;"]),N=u.d.div.withConfig({displayName:"CreatePage__WrapperHeader",componentId:"sc-1wgylx9-3"})(["display:flex;align-items:center;width:100%;heigh:auto;background:#ffffff;border-bottom:1px solid #f1f1f1;padding-bottom:24px;"]),V=[{field:"name",conditions:[{name:"required",value:!0},{name:"minLength",value:5}]}],F=O(s.w,{},void 0,"T\xean \u0111\u1ed1i t\u01b0\u1ee3ng"),L=O(s.f,{label:O(s.w,{},void 0,"Lo\u1ea1i \u0111\u1ed1i t\u01b0\u1ee3ng"),name:"objectType"},void 0,O(s.h,{list:g.a})),_=O(s.w,{},void 0,"Lo\u1ea1i s\u1ea3n ph\u1ea9m"),q=O(s.w,{},void 0,"V\xf9ng s\u1ea3n xu\u1ea5t"),E=O(s.w,{},void 0,"Quy tr\xecnh"),H=O(s.w,{},void 0,"M\xf4 t\u1ea3 s\u1ea3n ph\u1ea9m"),W=O(s.w,{},void 0,"H\xecnh \u1ea3nh \u0111\u1ed1i t\u01b0\u1ee3ng"),R=O(s.E,{height:50});function $(e){var n=e.productObject,t=Object(f.useDispatch)(),a=Object(d.useHistory)(),r=Object(f.useSelector)((function(e){return e.farm.item.id})),u=D(C(),1)[0],j=D(Object(o.useState)(0),2),I=j[0],T=j[1],$=D(Object(o.useState)(!1),2),z=$[0],J=$[1],K=D(Object(o.useState)({}),2),M=K[0],B=K[1],G=Object(h.a)({selector:function(e){return e.product.list},action:b.c,query:x(x({},w.d),{},{where:{farmID:r}})}).data,Q=Object(h.a)({selector:function(e){return e.area.list},action:v.c,query:x(x({},w.a),{},{where:{farmID:r}})}).data,U=Object(h.a)({selector:function(e){return e.process.list},action:p.e,query:x(x({},w.c),{},{where:{farmID:r}})}).data;return Object(o.useEffect)((function(){g.a.length>0&&u.setFieldsValue({objectType:g.a[0].value}),G.length>0&&u.setFieldsValue({productID:G[0].value}),Q.length>0&&u.setFieldsValue({areaID:Q[0].value}),U.length>0&&u.setFieldsValue({processID:U[0].value})}),[G,Q,U]),c.a.createElement(c.a.Fragment,null,O(P,{},void 0,O(N,{},void 0,O(s.A,{title:"Th\xeam m\u1edbi ".concat(n.name),description:" V\u1ed1n FDI \u0111\u1ed5 v\xe0o b\u1ea5t \u0111\u1ed9ng s\u1ea3n qu\xfd I t\u0103ng m\u1ea1nh nh\u1edd DN n\u01b0\u1edbc ngo\xe0i tin t\u01b0\u1edfng v\u1ec1 kh\u1ea3 n\u0103ng kh\u1ed1ng ch\u1ebf d\u1ecbch c\u1ee7a Vi\u1ec7t Nam."})),O(A,{},void 0,O(S,{},void 0,O(s.A,{subTitle:"Th\xeam m\u1edbi ".concat(n.name),description:" V\u1ed1n FDI \u0111\u1ed5 v\xe0o b\u1ea5t \u0111\u1ed9ng s\u1ea3n qu\xfd I t\u0103ng m\u1ea1nh nh\u1edd DN n\u01b0\u1edbc ngo\xe0i tin t\u01b0\u1edfng v\u1ec1 kh\u1ea3 n\u0103ng kh\u1ed1ng ch\u1ebf d\u1ecbch c\u1ee7a Vi\u1ec7t Nam."}),O(i.a,{style:{marginTop:"20px"},labelCol:{span:5},wrapperCol:{span:11},layout:"horizontal",labelAlign:"left",form:u,onValuesChange:function(e){B(x(x({},M),e))}},void 0,O(s.f,{label:F,name:"name",rules:[{required:!0,minLength:5,message:"B\u1ea1n ch\u01b0a nh\u1eadp t\xean ".concat(n.name)}]},void 0,O(s.u,{placeholder:"Nh\u1eadp t\xean ".concat(n.name),size:"large"})),L,O(s.f,{label:_,name:"productID"},void 0,O(s.h,{list:G})),O(s.f,{label:q,name:"areaID"},void 0,O(s.h,{list:Q})),O(s.f,{label:E,name:"processID"},void 0,O(s.h,{list:U})),O(s.f,{name:"description",label:H},void 0,O(s.G,{onChange:function(e){u.setFieldsValue({description:e})}})),O(s.A,{subTitle:"H\xecnh \u1ea3nh ".concat(n.name),description:" V\u1ed1n FDI \u0111\u1ed5 v\xe0o b\u1ea5t \u0111\u1ed9ng s\u1ea3n qu\xfd I t\u0103ng m\u1ea1nh nh\u1edd DN n\u01b0\u1edbc ngo\xe0i tin t\u01b0\u1edfng v\u1ec1 kh\u1ea3 n\u0103ng kh\u1ed1ng ch\u1ebf d\u1ecbch c\u1ee7a Vi\u1ec7t Nam."}),O(s.f,{label:W},void 0,O(s.l,{valuePropName:"fileList",name:"medias",getValueFromEvent:function(e){if(Array.isArray(e))return e;var n=e.fileList;return Array.isArray(n)&&T(n.length),e&&e.fileList},count:I}))),R))),O(s.o,{content:["H\u1ee7y th\xeam m\u1edbi","L\u01b0u l\u1ea1i"],urlExit:"/field-plant",onSubmit:function(){u.validateFields().then(function(){var e,r=(e=regeneratorRuntime.mark((function e(r){var i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=x(x({},r),{},{type:n.type}),Object(m.a)(i,"medias","images"),Object(m.a)(i,"objectType","number"),Object(s.y)("info","\u0110ang t\u1ea1o ".concat(n.name)),J(!0),e.prev=5,e.next=8,t(Object(y.a)(i));case 8:o=e.sent,Object(l.unwrapResult)(o),Object(s.y)("success","T\u1ea1o ".concat(n.name," th\xe0nh c\xf4ng")),J(!1),a.push("/".concat(n.path,"/list")),e.next=19;break;case 15:e.prev=15,e.t0=e.catch(5),J(!1),Object(s.y)("error","T\u1ea1o ".concat(n.name," th\u1ea5t b\u1ea1i"));case 19:case"end":return e.stop()}}),e,null,[[5,15]])})),function(){var n=this,t=arguments;return new Promise((function(a,r){var i=e.apply(n,t);function o(e){k(i,a,r,o,c,"next",e)}function c(e){k(i,a,r,o,c,"throw",e)}o(void 0)}))});return function(e){return r.apply(this,arguments)}}())},isSubmitting:z,src:M,rules:V}))}n.default=$}}]);