1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[351],{43013:(e,r,l)=>{"use strict";l.d(r,{O:()=>t});let t={labelRowsPerPage:"表示件æ°:",labelDisplayedRows:e=>{let{from:r,to:l,count:t}=e;return"".concat(r,"â").concat(l," / ").concat(-1!==t?t:"".concat(l,"+"),"ä»¶")}}},56304:(e,r,l)=>{"use strict";l.d(r,{ij:()=>x,zc:()=>c,BW:()=>d,RF:()=>a});let{GET:t,POST:i,PUT:n,PATCH:o,DELETE:s}=(0,l(24235).Ay)({baseUrl:"/",credentials:"include"}),c=t,a=i,d=o,x=s},76617:(e,r,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/jmtyspot_admin/combo_price_rules",function(){return l(76885)}])},76885:(e,r,l)=>{"use strict";l.r(r),l.d(r,{__N_SSG:()=>M,default:()=>B});var t=l(37876),i=l(46520),n=l(97268),o=l(91535),s=l(88992),c=l(11054),a=l(94515),d=l(46229),x=l(32643),u=l(71686),h=l(81567),p=l(14232),m=l(13810),b=l(10183),g=l(56304),j=l(88537),y=l(3112);let A=e=>y.YjP().min(1,"".concat(e,"ãå
¥åãã¦ãã ãã")).transform(e=>Number(e)).pipe(y.aig({error:"æ°å¤ãå
¥åãã¦ãã ãã"}).int("æ´æ°ã§å
¥åãã¦ãã ãã").min(1,"1以ä¸ã§å
¥åãã¦ãã ãã")),v=y.Ikc({quantity:A("åæ°"),comboPrice:A("ã»ããä¾¡æ ¼"),singlePrice:A("ååä¾¡æ ¼")}),_={quantity:"quantity",combo_price:"comboPrice",single_price:"singlePrice"},f=e=>{let[r,l]=(0,p.useState)(!1),{enqueueSnackbar:t}=(0,b.dh)(),{handleAuthError:i}=(0,j.M)(),{control:n,handleSubmit:o,reset:c,setError:a,formState:{errors:d}}=(0,s.mN)({resolver:(0,m.u)(v),defaultValues:{quantity:"",comboPrice:"",singlePrice:""}});return{control:n,errors:d,isSubmitting:r,handleSubmit:o(async r=>{l(!0);try{var n,o,s,d,x;let{error:l,response:u}=await (0,g.RF)("/web_api/v1/jmty_spot/combo_price_rules",{body:{quantity:r.quantity,combo_price:r.comboPrice,single_price:r.singlePrice}});if(!i(u))return;if(u.ok){t("ã¾ã¨ãã¦å²ãç»é²ãã¾ãã",{variant:"success"}),c(),e();return}let h=l&&"validation_error"in l?null==(n=l.validation_error)?void 0:n.combo_price_rule:void 0,p=null!=h?h:{};Object.entries(_).forEach(e=>{var r;let[l,t]=e,i=null==(r=p[l])?void 0:r[0];i&&a(t,{message:i})});let m=null==(s=Object.entries(p).find(e=>{let[r]=e;return!(r in _)}))||null==(o=s[1])?void 0:o[0];t(null!=(x=null!=m?m:null==l||null==(d=l.error)?void 0:d.message)?x:"ã¾ã¨ãã¦å²ã®ç»é²ã«å¤±æãã¾ãã",{variant:"error"})}finally{l(!1)}})}},P=e=>(0,t.jsx)(n.A,{component:"label",htmlFor:e.htmlFor,variant:"caption",sx:{display:"block",fontWeight:600,color:"text.secondary",mb:.75},children:e.children}),w=e=>{let{control:r,errors:l,isSubmitting:o,handleSubmit:p}=f(e.onSuccess);return(0,t.jsxs)(c.A,{sx:{borderRadius:2,p:3,height:"100%",display:"flex",flexDirection:"column"},children:[(0,t.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:2},children:[(0,t.jsx)(u.A,{sx:{color:"primary.main"}}),(0,t.jsx)(n.A,{variant:"h6",sx:{fontWeight:700},children:"ã¾ã¨ãã¦å²ãç»é²"})]}),(0,t.jsxs)(i.A,{component:"form",onSubmit:p,sx:{display:"flex",flexDirection:"column",gap:2.5,flexGrow:1},children:[(0,t.jsxs)(i.A,{children:[(0,t.jsx)(P,{htmlFor:"combo-quantity",children:"åæ°"}),(0,t.jsx)(s.xI,{name:"quantity",control:r,render:e=>{var r;let{field:i}=e;return(0,t.jsx)(a.A,{...i,id:"combo-quantity",type:"number",placeholder:"ä¾: 2",size:"small",fullWidth:!0,slotProps:{htmlInput:{inputMode:"numeric",min:1}},error:!!l.quantity,helperText:null==(r=l.quantity)?void 0:r.message})}})]}),(0,t.jsxs)(i.A,{children:[(0,t.jsx)(P,{htmlFor:"combo-combo-price",children:"ã»ããä¾¡æ ¼"}),(0,t.jsx)(s.xI,{name:"comboPrice",control:r,render:e=>{var r;let{field:i}=e;return(0,t.jsx)(a.A,{...i,id:"combo-combo-price",type:"number",placeholder:"ä¾: 100",size:"small",fullWidth:!0,slotProps:{htmlInput:{inputMode:"numeric",min:1},input:{endAdornment:(0,t.jsx)(d.A,{position:"end",children:"å"})}},error:!!l.comboPrice,helperText:null==(r=l.comboPrice)?void 0:r.message})}})]}),(0,t.jsxs)(i.A,{children:[(0,t.jsx)(P,{htmlFor:"combo-single-price",children:"ååä¾¡æ ¼"}),(0,t.jsx)(s.xI,{name:"singlePrice",control:r,render:e=>{var r;let{field:i}=e;return(0,t.jsx)(a.A,{...i,id:"combo-single-price",type:"number",placeholder:"ä¾
1: 100",size:"small",fullWidth:!0,slotProps:{htmlInput:{inputMode:"numeric",min:1},input:{endAdornment:(0,t.jsx)(d.A,{position:"end",children:"å"})}},error:!!l.singlePrice,helperText:null==(r=l.singlePrice)?void 0:r.message})}})]}),(0,t.jsx)(i.A,{sx:{mt:"auto",pt:2},children:(0,t.jsx)(x.A,{type:"submit",variant:"contained",fullWidth:!0,disabled:o,startIcon:(0,t.jsx)(h.A,{}),sx:{py:1.5,fontWeight:700},children:"ã¾ã¨ãã¦å²ãç»é²"})})]})]})};var S=l(65965),k=l(68474),W=l(451),q=l(78423),R=l(84676),C=l(9858),I=l(1413),z=l(86035),N=l(12944),T=l(97625),F=l(43013),O=l(75656);let D=()=>{let{enqueueSnackbar:e}=(0,b.dh)(),{handleAuthError:r}=(0,j.M)(),[l,t]=(0,p.useState)(null),{data:i,isLoading:n,mutate:o}=(0,O.Ay)("/web_api/v1/jmty_spot/combo_price_rules",async()=>{var e,r;return null!=(r=null==(e=(await (0,g.zc)("/web_api/v1/jmty_spot/combo_price_rules",{})).data)?void 0:e.combo_price_rules)?r:[]});return{rules:null!=i?i:[],isLoading:n,pendingId:l,handleTogglePostable:async l=>{t(l.id);try{let{error:t,response:d}=await (0,g.BW)("/web_api/v1/jmty_spot/combo_price_rules/{id}",{params:{path:{id:l.id}},body:{postable:!l.postable}});if(!r(d))return;if(!d.ok){var i,n,s,c,a;let r=t&&"validation_error"in t?null==(s=t.validation_error)||null==(n=s.combo_price_rule)||null==(i=n.postable)?void 0:i[0]:void 0;e(null!=(a=null!=r?r:null==t||null==(c=t.error)?void 0:c.message)?a:"æ´æ°ã«å¤±æãã¾ãã",{variant:"error"});return}e(l.postable?"ã«ã¼ã«ãç¡å¹ã«ãã¾ãã":"ã«ã¼ã«ãæå¹ã«ãã¾ãã",{variant:"success"}),o()}finally{t(null)}}}},E=()=>{let{rules:e,isLoading:r,pendingId:l,handleTogglePostable:o}=D(),[s,a]=(0,p.useState)(0),[d,x]=(0,p.useState)(10),u=e.slice(s*d,s*d+d);return(0,t.jsxs)(c.A,{sx:{borderRadius:2,overflow:"hidden",display:"flex",flexDirection:"column",height:"100%"},children:[(0,t.jsx)(i.A,{sx:{p:2.5,borderBottom:"1px solid",borderColor:"divider",bgcolor:"grey.50"},children:(0,t.jsx)(n.A,{variant:"h6",sx:{fontWeight:700},children:"ã¾ã¨ãã¦å² ä¸è¦§"})}),r?(0,t.jsx)(i.A,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,t.jsx)(S.A,{color:"primary"})}):0===e.length?(0,t.jsx)(i.A,{sx:{py:8,textAlign:"center"},children:(0,t.jsx)(n.A,{color:"text.secondary",children:"ã¾ã¨ãã¦å²ã«ã¼ã«ãç»é²ããã¦ãã¾ãã"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(k.A,{sx:{flexGrow:1},children:(0,t.jsxs)(W.A,{stickyHeader:!0,size:"small",children:[(0,t.jsx)(q.A,{children:(0,t.jsxs)(R.A,{children:[(0,t.jsx)(C.A,{sx:T.r,children:"ã«ã¼ã«å"}),(0,t.jsx)(C.A,{sx:T.r,children:"ã¿ã¤ãã«ã©ãã«"}),(0,t.jsx)(C.A,{sx:{...T.r,textAlign:"right"},children:"åæ°"}),(0,t.jsx)(C.A,{sx:{...T.r,textAlign:"right"},children:"ã»ããä¾¡æ ¼"}),(0,t.jsx)(C.A,{sx:{...T.r,textAlign:"right"},children:"ååä¾¡æ ¼"}),(0,t.jsx)(C.A,{sx:{...T.r,textAlign:"center"},children:"æå¹"})]})}),(0,t.jsx)(I.A,{children:u.map(e=>(0,t.jsxs)(R.A,{hover:!0,sx:{opacity:e.postable?1:.6,"&:hover":{bgcolor:"grey.50"}},children:[(0,t.jsx)(C.A,{children:(0,t.jsx)(n.A,{variant:"body2",sx:{fontWeight:600},children:e.name})}),(0,t.jsx)(C.A,{children:(0,t.jsx)(n.A,{variant:"body2",color:"text.secondary",children:e.article_title_label})}),(0,t.jsx)(C.A,{sx:{textAlign:"right"},children:(0,t.jsx)(n.A,{variant:"body2",color:"text.secondary",children:e.quantity})}),(0,t.jsx)(C.A,{sx:{textAlign:"right"},children:(0,t.jsxs)(n.A,{variant:"body2",color:"text.secondary",children:[e.combo_price.toLocaleString(),"å"]})}),(0,t.jsx)(C.A,{sx:{textAlign:"right"},children:(0,t.jsxs)(n.A,{variant:"body2",color:"text.secondary",children:[e.single_price.toLocaleString(),"å"]})}),(0,t.jsx)(C.A,{sx:{textAlign:"center"},children:(0,t.jsx)(z.A,{checked:e.postable,onChange:()=>o(e),disabled:l===e.id,size:"small",inputProps:{"aria-label":"".concat(e.name,"ã®æå¹/ç¡å¹")}})})]},e.id))})]})}),(0,t.jsx)(N.A,{component:"div",count:e.length,page:s,onPageChange:(e,r)=>a(r),rowsPerPage:d,onRowsPerPageChange:e=>{x(Number(e.target.value)),a(0)},rowsPerPageOptions:[10,20,50],labelRowsPerPage:F.O.labelRowsPerPage,labelDisplayedRows:F.O.labelDisplayedRows,sx:{borderTop:"1px solid",borderColor:"divider",bgcolor:"grey.50"}})]})]})};var M=!0;let B=()=>{let{mutate:e}=(0,o.iX)();return(0,t.jsxs)(i.A,{children:[(0,t.jsxs)(i.A,{sx:{mb:4},children:[(0,t.jsx)(n.A,{variant:"h4",component:"h1",sx:{fontWeight:900,letterSpacing:"-0.025em",color:"text.primary"},children:"ã¾ã¨ãã¦å²ç®¡ç"}),(0,t.jsx)(n.A,{variant:"body1",color:"text.secondary",sx:{mt:.5},children:"ååã®ã¾ã¨ãã¦å²å¼ã«ã¼ã«ã管çãã¾ã"})]}),(0,t.jsxs)(i.A,{sx:{display:"flex",flexDirection:{xs:"column",lg:"row"},gap:4},children:[(0,t.jsx)(i.A,{sx:{width:{xs:"100%",lg:"33.333%"},flexShrink:0},children:(0,t.jsx)(w,{onSuccess:()=>{e(e=>"string"==typeof e&&e.includes("/jmty_spot/combo_price_rules"))}})}),(0,t.jsx)(i.A,{sx:{width:{xs:"100%",lg:"66.666%"}},children:(0,t.jsx)(E,{})})]})]})}},88537:(e,r,l)=>{"use strict";l.d(r,{M:()=>n});var t=l(89099),i=l(14232);let n=()=>{let e=(0,t.useRouter)();return{handleAuthError:(0,i.useCallback)(r=>
1401===r.status?(e.push("/login"),!1):403!==r.status||(e.push("/"),!1),[e])}}},97625:(e,r,l)=>{"use strict";l.d(r,{r:()=>t,v:()=>i});let t={fontWeight:700,fontSize:"0.75rem",color:"text.secondary",textTransform:"uppercase",letterSpacing:"0.05em",bgcolor:"grey.50"},i={position:"fixed",bottom:0,left:0,right:0,bgcolor:"background.paper",borderTop:"1px solid",borderColor:"divider",px:4,py:3,boxShadow:"0 -4px 10px rgba(0,0,0,0.05)",zIndex:40}}},e=>{var r=r=>e(e.s=r);e.O(0,[97,3327,5218,5767,9294,9586,4515,148,636,6593,8792],()=>r(76617)),_N_E=e.O()}]); 2//# sourceMappingURL=combo_price_rules-636dff1835b18457.js.map
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.