1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0d369c7e-a8e5-4508-8e16-d3ac9b15106f",e._sentryDebugIdIdentifier="sentry-dbid-0d369c7e-a8e5-4508-8e16-d3ac9b15106f")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8470],{51579:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(37876),s=n(35791),i=n(42556),a=n(22127),d=n(58667),l=n(45300),u=n(14232),c=n(21728),h=n(40498),o=n(13863);let f=e=>{let{formInputs:t,formValues:n,onChange:s,errors:l}=e;return t.map(e=>(0,r.jsxs)(i.VP,{xs:"100%",lg:e.full?"100%":"50%",style:{paddingBottom:d.gutterWidth},children:[(0,r.jsx)(c.A,{field:e,formValues:n,onChange:s,uploadTo:"/admin/themes"}),l[e.id]&&(0,r.jsx)(a.Kw,{children:l[e.id]})]},"field_".concat(e.id)))},m=function(e){let{templateVars:t}=e,{need:n}=t,c="/admin/user-needs";n&&(c+="/".concat(n.id));let[m,x]=(0,u.useState)(n||{}),[g,p]=(0,u.useState)(!1),b=[{type:"text",id:"name",humanName:"Name",required:!0},{type:"text",id:"alternativeName",humanName:"Alternative Name",required:!1},{type:"text",id:"signupCheckboxLabel",humanName:"Signup Checkbox Label (Configure exhibition on theme editor)",required:!1},{type:"text",id:"signupCheckboxHelperText",humanName:"Signup Checkbox Helper Text",required:!1},{type:"boolean",id:"default",humanName:"Default",required:!1}],[y,j]=(0,u.useState)({}),[w,_]=(0,u.useState)(),N=async e=>{e.preventDefault(),_(),j({}),p(!0);let t=(0,h.l)(b,m);if(Object.keys(t).length>0){j(t),_("The form has errors. Please check all required fields are entered.");return}try{await (0,o.bE)({values:m,location:c,method:n?"PUT":"POST"})}catch(e){_("There was an error when saving the training ".concat("object"==typeof e.message?JSON.stringify(e.message):e.message))}finally{p(!1)}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.lZ,{children:(0,r.jsx)(i.mc,{children:(0,r.jsxs)(i.fI,{children:[(0,r.jsx)(i.VP,{children:(0,r.jsx)("h2",{children:n?"Edit":"New Need"})}),(0,r.jsx)(i.VP,{style:{textAlign:"right"},children:(0,r.jsx)(a.$n,{small:!0,secondary:!0,href:"/admin/user-needs",children:"Back to List"})})]})})}),(0,r.jsx)(i.mc,{style:{paddingTop:d.gutterWidth},children:(0,r.jsx)(l.A,{children:(0,r.jsxs)(a.lV,{onSubmit:N,children:[(0,r.jsx)(i.fI,{children:(0,r.jsx)(f,{formInputs:b,formValues:m,onChange:(e,t,n)=>{let r="boolean"===n?e.target.checked:e.target.value;x({...m,[t]:r})},errors:y})}),(0,r.jsxs)(i.fI,{children:[w&&(0,r.jsx)(i.VP,{xs:"100%",children:(0,r.jsx)(a.Kw,{children:w})}),(0,r.jsx)(i.VP,{xs:"100%",children:(0,r.jsx)(a.$n,{type:"submit",primary:!0,disabled:g,neutral:g,children:"Save Data"})})]})]})})})]})}},52182:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r.A});var r=n(51579)},63152:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/user-needs/new",function(){return n(52182)}])}},e=>{e.O(0,[5838,2127,636,6593,8792],()=>e(e.s=63152)),_N_E=e.O()}]); 2//# sourceMappingURL=new-06197c267c3a2e2e.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.