1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4058],{82119:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/tiers/[tier-id]",function(){return s(86446)}])},86446:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSP:function(){return w},default:function(){return S}});var l=s(47568),i=s(26042),r=s(10092),t=s(85893),c=s(67294),a=(s(41664),s(89265)),o=s(65474),d=s(86078),u=(s(32347),s(40062),s(27704),s(82580)),h=s(74231),x=(s(36115),s(4327)),m=s(10253),p=s(26447),j=s(34386),b=s(89583),v=function(e){var n=e.label,s=e.info,l=(0,x.Z)(e,["label","info"]),r=(0,m.Z)((0,u.U$)(l),3),a=r[0],o=r[1],d=r[2].setValue,h="checkbox"==l.type?"16px":"50%";return(0,c.useEffect)((function(){if("datetime-local"==l.type){var e=convertToTimezone(a.value);e=e.slice(0,16),d(e)}}),[]),(0,t.jsxs)("div",{className:"col-12 d-flex",children:[(0,t.jsx)("div",{className:"col-3",children:(0,t.jsx)("label",{htmlFor:l.id||l.name,children:(0,t.jsxs)(p.Z,{direction:"row",alignItems:"center",gap:1,children:[(0,t.jsxs)("div",{children:[n,":"]}),s?(0,t.jsx)(j.Z,{title:s,children:(0,t.jsx)("div",{children:(0,t.jsx)(b.DAO,{style:{width:"16px"}})})}):null]})})}),(0,t.jsxs)("div",{className:"col-9",children:[(0,t.jsx)("input",(0,i.Z)({style:{width:h},className:"text-input"},a,l)),o.touched&&o.error?(0,t.jsx)("div",{className:"error",children:o.error}):null]})]})},f=function(e){var n=e.label,s=(0,x.Z)(e,["label"]),l=(0,m.Z)((0,u.U$)(s),2),r=l[0],c=l[1];return(0,t.jsxs)("div",{className:"col-12 d-flex",children:[(0,t.jsx)("div",{className:"col-3",children:(0,t.jsxs)("label",{htmlFor:s.id||s.name,children:[n,": "]})}),(0,t.jsxs)("div",{className:"col-9",children:[(0,t.jsx)("textarea",(0,i.Z)({style:{width:"50%"},className:"text-input"},r,s)),c.touched&&c.error?(0,t.jsx)("div",{className:"error",children:c.error}):null]})]})},y=function(e){var n=e.label,s=(0,x.Z)(e,["label"]),l=(0,m.Z)((0,u.U$)(s),2),r=l[0],c=l[1];return(0,t.jsxs)("div",{className:"col-12 d-flex",children:[(0,t.jsx)("div",{className:"col-3",children:(0,t.jsxs)("label",{htmlFor:s.id||s.name,children:[n,": "]})}),(0,t.jsxs)("div",{className:"col-9",children:[(0,t.jsx)("select",(0,i.Z)({style:{width:"50%"}},r,s)),c.touched&&c.error?(0,t.jsx)("div",{className:"error",children:c.error}):null]})]})},N=function(e){var n=e.label,s=(0,x.Z)(e,["label"]),l=(0,m.Z)((0,u.U$)(s),2),i=l[0];l[1];return(0,t.jsxs)("div",{className:"col-12 d-flex",children:[(0,t.jsx)("div",{className:"col-3",children:(0,t.jsxs)("label",{children:[n,": "]})}),(0,t.jsx)("div",{className:"col-9",children:i.value})]})},Z=function(e){var n=e.label,s=(0,x.Z)(e,["label"]),l=(0,m.Z)((0,u.U$)(s),2),i=l[0],r=(l[1],s.options);return(0,t.jsxs)("div",{className:"col-12 d-flex",children:[(0,t.jsx)("div",{className:"col-3",children:(0,t.jsxs)("label",{children:[n,": "]})}),(0,t.jsx)("div",{className:"col-9",children:r[i.value]})]})},g=s(51626),_=s(67720),w=!0,S=function(e){var n=e.data,s=(0,c.useState)(n),x=s[0],m=(s[1],(0,c.useState)("Details")),j=(m[0],m[1],{month:"Monthly",year:"Annually"}),b=function(){var e=(0,l.Z)((function(e){var n,s,l,t,c;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return n=(0,i.Z)({},e),s=n.product_id,l=null,s?[4,(0,g.wk)(n)]:[3,2];case 1:return l=r.sent(),[3,4];case 2:return[4,(0,g.tP)(n)];case 3:l=r.sent(),r.label=4;case 4:return r.trys.push([4,9,,10]),[4,fetch("".concat("https://internationalgrooms.org/api","/v1/membership_tier/update/").concat(n.id),{method:"POST",credentials:"include",body:JSON.stringify(l)})];case 5:return(t=r.sent()).ok?[4,t.json()]:[3,7];case 6:return r.sent(),[3,8];case 7:console.log(t.statusText),r.label=8;case 8:return[3,10];case 9:return c=r.sent(),console.log(c),[3,10];case 10:return[2]}}
1))}));return function(n){return e.apply(this,arguments)}}();return(0,t.jsx)(u.J9,{initialValues:x,validationSchema:h.Ry({title:h.Z_().required("Please enter a title"),description:h.Z_().required("Please enter a description")}),onSubmit:function(){var e=(0,l.Z)((function(e,n){var s;return(0,r.__generator)(this,(function(l){switch(l.label){case 0:return(s=n.setSubmitting)(!0),[4,b(e)];case 1:return l.sent(),s(!1),[2]}}))}));return function(n,s){return e.apply(this,arguments)}}(),children:function(e){var n=e.values,s=(e.errors,e.touched,e.handleChange,e.handleBlur,e.handleSubmit),l=e.isSubmitting;return(0,t.jsx)(u.l0,{onSubmit:function(e){e.preventDefault(),s(e)},style:{width:"100%"},children:(0,t.jsxs)(a.Z,{children:[(0,t.jsxs)(o.Z,{title:"",children:[(0,t.jsx)("div",{className:"cms-members-form col-12 d-flex"}),(0,t.jsxs)("div",{className:"col-12",children:[(0,t.jsx)("div",{className:"h3 my-2 py-2",children:"Membership Tier:"}),(0,t.jsxs)(p.Z,{gap:1,children:[(0,t.jsx)(v,{label:"Enabled",name:"enabled",type:"checkbox"}),(0,t.jsx)(v,{label:"Title",name:"title"}),(0,t.jsx)(f,{label:"Description",name:"description"}),(null===n||void 0===n?void 0:n.id)?(0,t.jsx)(Z,{label:"Frequency",name:"frequency",options:j}):(0,t.jsx)(y,{label:"Frequency",name:"frequency",children:Object.keys(j).map((function(e){return(0,t.jsx)("option",{value:e,children:j[e]},e)}))})]}),(0,t.jsx)(u.F2,{name:"prices",render:function(e){return(0,t.jsxs)(p.Z,{gap:1,children:[(0,t.jsx)("div",{className:"h3 my-2 py-2",children:(0,t.jsxs)(p.Z,{direction:"row",alignItems:"center",gap:1,children:["Prices:",(0,t.jsx)("button",{type:"button",className:"small",onClick:function(){return e.push({currency:"EUR",price:0})},children:"Add Price"})]})}),(null===n||void 0===n?void 0:n.prices)&&n.prices.length>0?n.prices.map((function(e,n){return(0,t.jsxs)(p.Z,{gap:1,children:[(0,t.jsxs)(y,{label:"Currency",name:"prices[".concat(n,"].currency"),children:[(0,t.jsx)("option",{children:"EUR"}),(0,t.jsx)("option",{children:"GBP"}),(0,t.jsx)("option",{children:"USD"})]}),(0,t.jsx)(v,{label:"Price",name:"prices[".concat(n,"].price"),type:"number"}),e.subscription_id?(0,t.jsx)(N,{label:"Subscription ID",name:"prices[".concat(n,"].subscription_id")}):null,e.payment_id?(0,t.jsx)(N,{label:"Payment ID",name:"prices[".concat(n,"].payment_id")}):null,(0,t.jsx)(_.Z,{})]},n)})):null]})}}),(0,t.jsx)(u.F2,{name:"discounts",render:function(e){return(0,t.jsxs)(p.Z,{gap:1,children:[(0,t.jsx)("div",{className:"h3 my-2 py-2",children:(0,t.jsxs)(p.Z,{direction:"row",alignItems:"center",gap:1,children:["Discounts:",(0,t.jsx)("button",{type:"button",className:"small",onClick:function(){return e.push("")},children:"Add Discount"})]})}),(null===n||void 0===n?void 0:n.discounts)&&n.discounts.length>0?n.discounts.map((function(e,n){return(0,t.jsxs)(p.Z,{gap:1,children:[(0,t.jsx)(v,{label:"Enabled",name:"discounts[".concat(n,"].enabled"),type:"checkbox"}),(0,t.jsx)(v,{label:"Name",name:"discounts[".concat(n,"].name")}),(0,t.jsxs)(y,{label:"Discount Type",name:"discounts[".concat(n,"].type"),children:[(0,t.jsx)("option",{value:"fixed",children:"Fixed"}),(0,t.jsx)("option",{value:"percent",children:"Percent"})]}),(0,t.jsx)(v,{label:"Amount",name:"discounts[".concat(n,"].amount"),type:"number"}),(0,t.jsx)(v,{label:"Repeating",info:"If ticked the discount will be applied through all renewals",name:"discounts[".concat(n,"].repeating"),type:"checkbox"}),(0,t.jsx)(_.Z,{})]},n)})):null]})}})]})]}),(0,t.jsx)(d.Z,{children:(0,t.jsx)("button",{disabled:l,type:"submit",className:"btn green",children:"Save"})})]})})}})}}},function(e){e.O(0,[5445,5675,876,1127,9963,4231,2580,3266,1344,3946,9265,6155,9397,4422,9774,2888,179],(function(){return n=82119,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
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.