1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8243],{62978:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/gift-receptions/basic-info",function(){return i(62615)}])},62615:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return basic_info}});var n=i(85893),r=i(9008),o=i.n(r),a=i(67294),l=i(11010),s=i(72253),d=i(14932),c=i(91309),u=i(97582),_=i(51350),f=i(56312),p=i(27484),h=i.n(p),v=i(11163),g=i(87536),x=i(91444),m=i(23919),b=i(67819),j=i(61903),y=i(51233),Z=i(15861),R=i(5616),S=i(94054),I=i(33841),P=i(73575),w=i(23599),C=i(15863),T=i(91050),L=i(50480),Y=i(36872),RadioSection=function(e){var t=e.title,i=e.options,r=e.name,o=e.control;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Z.Z,{variant:"Roboto_body2",children:t}),(0,n.jsx)(g.Qr,{name:r,control:o,render:function(e){var t=e.field;return(0,n.jsx)(T.Z,(0,d._)((0,s._)({},t),{onChange:function(e){return t.onChange("true"===e.target.value)},sx:{ml:1.5},children:i.map(function(e){return(0,n.jsx)(L.Z,{value:e.value,control:(0,n.jsx)(Y.Z,{}),label:(0,n.jsx)(Z.Z,{variant:"Roboto_subtitle1",children:e.label}),sx:{marginLeft:"-12px"}},e.label)})}))}})]})},E=i(82723),W=i(66519),D=i(8003),F=i(94097),GiftReceptionsBasicInfoPresentation=function(e){var t=e.onFileChange,i=e.control,r=e.handleSubmit,o=e.onSubmit,a=e.onSubmitInvalid,l=e.onChangeTenant,c=e.errors,u=e.recipients,_=e.users,f=e.giftReceptionTypes,p=e.isLoadingTenantWithUsers,h=e.isLoadingPage,v=e.ogp_image,x=e.isDirty,m=e.widthPx,b=e.heightPx,T=e.isSaving;return(0,n.jsxs)(F.Z,{onClick:function(){return r(o,a)()},isLoading:h,isDirty:x,isSaving:void 0!==T&&T,children:[(0,n.jsxs)(W.h,{title:"å
¨ä½è¨å®",children:[(0,n.jsx)(g.Qr,{name:"title",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(j.Z,(0,d._)((0,s._)({},i),{label:"æ¡ä»¶å (å¿
é )",fullWidth:!0,variant:"outlined",multiline:!0,minRows:2,error:!!(null==c?void 0:c.title),helperText:null==c?void 0:null===(t=c.title)||void 0===t?void 0:t.message}))}}),(0,n.jsx)(g.Qr,{name:"admin_title",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(j.Z,(0,d._)((0,s._)({},i),{label:"管çç¨æ¡ä»¶å (å¿
é )",fullWidth:!0,variant:"outlined",inputProps:{maxLength:255},error:!!c.admin_title,helperText:null===(t=c.admin_title)||void 0===t?void 0:t.message}))}}),(0,n.jsxs)(y.Z,{gap:2,children:[(0,n.jsx)(Z.Z,{variant:"Roboto_formLabel2",children:"å
¬éè¨å®"}),(0,n.jsxs)(y.Z,{gap:3,children:[(0,n.jsx)(R.Z,{children:(0,n.jsx)(RadioSection,{title:"ãç¥ãè±ä¸è¦§ãã¼ã¸",name:"is_list_public",control:i,options:[{value:!0,label:"表示"},{value:!1,label:"é表示"}]})}),(0,n.jsx)(R.Z,{children:(0,n.jsx)(RadioSection,{title:"åéãã¼ã¸",name:"is_order_public",control:i,options:[{value:!0,label:"åéä¸"},{value:!1,label:"åéçµäº"}]})}),(0,n.jsx)(R.Z,{children:(0,n.jsx)(RadioSection,{title:"ç´åå ±åãã¼ã¸",name:"is_delivery_report_public",control:i,options:[{value:!0,label:"å
¬é"},{value:!1,label:"éå
¬é"}]})}),(0,n.jsx)(g.Qr,{name:"uri",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(j.Z,(0,d._)((0,s._)({},i),{label:"URL (å¿
é )",fullWidth:!0,variant:"outlined",placeholder:"matomeru-renewal",error:!!c.uri,helperText:null===(t=c.uri)||void 0===t?void 0:t.message}))}})]})]})]}),(0,n.jsxs)(W.h,{title:"åºæ¬æ
å ±",children:[(0,n.jsx)(g.Qr,{name:"gift_reception_type_id",control:i,render:function(e){var t,i=e.field;return(0,n.jsxs)(S.Z,{fullWidth:!0,children:[(0,n.jsx)(I.Z,{id:"gift-reception-type-label",children:"åé種å¥"}),(0,n.jsx)(P.Z,(0,d._)((0,s._)({},i),{labelId:"gift-reception-type-label",id:"gift-reception-type-id",label:"åé種å¥",fullWidth:!0,inputProps:{helpertext:null===(t=c.gift_reception_type_id
1)||void 0===t?void 0:t.message,error:!!c.gift_reception_type_id},children:null==f?void 0:f.map(function(e){return(0,n.jsx)(w.Z,{value:e.id,children:e.title},e.id)})}))]})}}),(0,n.jsx)(g.Qr,{name:"tenant_id",control:i,render:function(e){var t,i=e.field;return(0,n.jsxs)(S.Z,{fullWidth:!0,children:[(0,n.jsx)(I.Z,{id:"tenant-id-label",children:"ä¼ç¤¾å"}),(0,n.jsx)(P.Z,(0,d._)((0,s._)({},i),{onChange:function(e){i.onChange(e),l(e)},labelId:"tenant-id-label",id:"tenant-id-label-id",label:"ä¼ç¤¾å",fullWidth:!0,inputProps:{helpertext:null===(t=c.tenant_id)||void 0===t?void 0:t.message,error:!!c.tenant_id},children:null==u?void 0:u.map(function(e){return(0,n.jsx)(w.Z,{value:e.id,children:"".concat(e.company_name," ").concat(e.display_name)},e.id)})}))]})}}),(0,n.jsx)(g.Qr,{name:"user_id",control:i,render:function(e){var t,i=e.field;return(0,n.jsxs)(S.Z,{fullWidth:!0,children:[(0,n.jsx)(I.Z,{id:"user-id-label",children:"æ
å½è
"}),(0,n.jsx)(P.Z,(0,d._)((0,s._)({},i),{labelId:"user-id-label",id:"user-id-label-id",label:"æ
å½è
",fullWidth:!0,inputProps:{helpertext:null===(t=c.user_id)||void 0===t?void 0:t.message,error:!!c.user_id},readOnly:p,children:null==_?void 0:_.map(function(e){return(0,n.jsx)(w.Z,{value:e.id,children:e.name},e.id)})}))]})}})]}),(0,n.jsxs)(W.h,{title:"æéã»å ´æ",children:[(0,n.jsx)(g.Qr,{name:"gift_reception_start_at",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(C.M,(0,d._)((0,s._)({},i),{format:"YYYY/MM/DD",label:"ãç¥ãåä»éå§æ¥ (å¿
é )",sx:{width:"100%"},slotProps:{textField:{helperText:null===(t=c.gift_reception_start_at)||void 0===t?void 0:t.message,error:!!c.gift_reception_start_at}}}))}}),(0,n.jsx)(g.Qr,{name:"gift_reception_end_at",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(C.M,(0,d._)((0,s._)({},i),{format:"YYYY/MM/DD",label:"ãç¥ãåä»çµäºæ¥ (å¿
é )",sx:{width:"100%"},slotProps:{textField:{helperText:null===(t=c.gift_reception_end_at)||void 0===t?void 0:t.message,error:!!c.gift_reception_end_at}}}))}}),(0,n.jsx)(g.Qr,{name:"delivery_at",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(C.M,(0,d._)((0,s._)({},i),{format:"YYYY/MM/DD",label:"ãç¥ãç´åäºå®æ¥ (å¿
é )",sx:{width:"100%"},slotProps:{textField:{helperText:null===(t=c.delivery_at)||void 0===t?void 0:t.message,error:!!c.delivery_at}}}))}}),(0,n.jsx)(g.Qr,{name:"delivery_location",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(j.Z,(0,d._)((0,s._)({},i),{label:"ãç¥ãç´åå ´æ (å¿
é )",fullWidth:!0,variant:"outlined",multiline:!0,minRows:2,helperText:null===(t=c.delivery_location)||void 0===t?void 0:t.message,error:!!c.delivery_location}))}})]}),(0,n.jsxs)(W.h,{title:"SEOè¨å®",children:[(0,n.jsx)(g.Qr,{name:"seo_title",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(j.Z,(0,d._)((0,s._)({},i),{label:"ã¿ã¤ãã« (å¿
é )",fullWidth:!0,variant:"outlined",helperText:null===(t=c.seo_title)||void 0===t?void 0:t.message,error:!!c.seo_title}))}}),(0,n.jsx)(g.Qr,{name:"seo_description",control:i,render:function(e){var t,i=e.field;return(0,n.jsx)(j.Z,(0,d._)((0,s._)({},i),{label:"ãã£ã¹ã¯ãªãã·ã§ã³ (å¿
é )",fullWidth:!0,variant:"outlined",multiline:!0,minRows:3,sx:{minHeight:"112px"},helperText:null===(t=c.seo_description)||void 0===t?void 0:t.message,error:!!c.seo_description}))}}),(0,n.jsx)(D.Z,{label:"OGPç»å",variant:"Roboto_formLabel1",children:(0,n.jsx)(E.z,{onFileChange:t,imageUrl:v,height:"315px",width:"600px",rounded:"4px",widthPx:m,heightPx:b})})]})]})},GiftReceptionsBasicInfoContainer=function(){var e,t=(0,v.useRouter)(),i=t.query.id,r=(0,a.useMemo)(function(){return isNaN(Number(i))?0:Number(i)},[i]),o=(0,c._)((0,a.useState)(!1),2),p=o[0],j=o[1],y=(0,g.cI)({resolver:(0,f.F)(m.iE),defaultValues:{id:void 0,title:"",admin_title:"",is_order_public:!0,is_list_public:!1,is_delivery_report_public:!1,uri:"",ogp_image:"",seo_title:"",seo_description:"",gift_reception_type_id:0,gift_reception_start_at:"",gift_reception_end_at:"",delivery_at:"",delivery_location:"",tenant_id:"",user_id:""},mode:"onChange"}),Z=y.control,R=y.handleSubmit,S=y.getValues,I=y.setValue,P=y.formState,w=P.errors,C=P.isDirty,T=y.register,L=y.reset,Y=(0,c._)((0,a.useState)(S("tenant_id")||""),2),E=Y[0],W=Y[1],D=(e=(0,l._)(function(e){var i,n,o;return(0,u.Jh)(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),j(!0),i=new FormData,Object.keys(e).forEach(function(t){var n=e[t];["gift_reception_start_at","gift_reception_end_at","delivery_at"].includes(t)&&h().isDayjs(n)&&i.append(t,n.locale("ja").format("YYYY-MM-DDT00:00:00.SSSZ")),"string"==typeof n||n instanceof Blob?i.append(t,n):("number"==typeof n||"boolean"==typeof n)&&i.append(t,n.toString())}),[4,b.L.admin.gift_receptions.basic_info.post({body:(0,s._)({},Object.fromEntries(i))})];case 1:return n=a.sent(),L((0,d._)((0,s._)({},n.body),{gift_reception_end_at:h()(n.body.gift_reception_end_at),gift_reception_start_at:h()(n.body.gift_reception_start_at),delivery_at:h()(n.body.delivery_at)})),0===r&&t.push("/admin/gift-receptions/basic-info?id=".concat(n.body.id)),x.toast.info("åºæ¬æ
å ±ãä¿åãã¾ãã",{toastId:"giftReceptionsBasicInfo"}),[3,4];
1case 2:return o=a.sent(),x.toast.error("åºæ¬æ
å ±ã®ä¿åã«å¤±æãã¾ãã",{toastId:"giftReceptionsBasicInfoError"}),console.error(o),[3,4];case 3:return j(!1),[7];case 4:return[2]}})}),function(t){return e.apply(this,arguments)}),F=(0,_.Z)(b.L.admin.recipients,{revalidateOnFocus:!1}),Q=F.data,M=F.error,O=(0,_.Z)(b.L.admin.tenants._id(E),{revalidateOnFocus:!1,enabled:""!==E,key:"tenantWithUsers-".concat(E)}),B=O.data,N=O.error,k=O.isLoading,U=T("tenant_id",{onChange:function(e){W(e.target.value)}}).onChange,G=(0,_.Z)(b.L.admin.gift_receptions.types,{revalidateOnFocus:!1}).data,V=(0,_.Z)(b.L.admin.gift_receptions._id(r).basic_info,{revalidateOnFocus:!1,enabled:0!==r}),X=V.data,q=V.isLoading;return((0,a.useEffect)(function(){!q&&X&&(W(X.tenant_id),L((0,d._)((0,s._)({},X),{gift_reception_end_at:h()(X.gift_reception_end_at),gift_reception_start_at:h()(X.gift_reception_start_at),delivery_at:h()(X.delivery_at)})))},[q,X,L]),M||N)?(0,n.jsx)("div",{children:"ããã³ãæ
å ±ã®åå¾ã«å¤±æãã¾ãã"}):(0,n.jsx)(GiftReceptionsBasicInfoPresentation,{onFileChange:function(e){e&&I("ogp_image",e,{shouldValidate:!0})},control:Z,handleSubmit:R,onSubmit:D,onSubmitInvalid:function(e){Object.keys(e).forEach(function(t){var i;"tenant_id"===t&&x.toast.error("ããã³ãã鏿ãã¦ãã ãã",{toastId:"giftReceptionsBasicInfoError"}),"gift_reception_type_id"===t&&x.toast.error("é©åãªåé種å¥ã鏿ãã¦ãã ãã",{toastId:"giftReceptionsBasicInfo".concat(t,"Error")}),x.toast.error(null===(i=e[t])||void 0===i?void 0:i.message,{toastId:"giftReceptionsBasicInfo".concat(t,"Error")})}),console.error(e)},onChangeTenant:U,errors:w,recipients:Q,isLoadingPage:q,users:null==B?void 0:B.tenantUsers,giftReceptionTypes:G,isLoadingTenantWithUsers:k,ogp_image:null==X?void 0:X.ogp_image,isDirty:C,widthPx:1200,heightPx:630,isSaving:p})},Component=function(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o(),{children:(0,n.jsx)("title",{children:"åºæ¬æ
å ± - 管çè
ç¨ | matomeru"})}),(0,n.jsx)(GiftReceptionsBasicInfoContainer,{})]})},basic_info=function(){return(0,n.jsx)(Component,{})}}},function(e){e.O(0,[6478,5675,5336,5901,6312,321,6202,3575,3803,4932,6545,7918,1535,5702,997,2382,3919,4875,9774,2888,179],function(){return e(e.s=62978)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.