1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3997],{584:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i});var a=s(37876),r=s(14232),n=s(54196),o=s(13734);s(93754),s(87740);var l=s(37661);let i=function(e){let{type:t,componentType:s,parentId:i}=e,[d,c]=(0,r.useState)(!1),[u,m]=(0,r.useState)(null),[h,x]=(0,r.useState)(""),[p,g]=(0,r.useState)({}),[f,v]=(0,r.useState)({}),w=async()=>{let e={};if(h||(e.Name="Please enter School Name."),Object.keys(e).length>0)return void v(e);v({});let a=document.getElementById("progress-bar");try{a.style.width="0%",a.style.transition="none",requestAnimationFrame(()=>{a.style.transition="width 0.5s ease",a.style.width="100%"});let e=await fetch("".concat(n.Qs,"slug/add"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({parent_id:i,name:h,type:t,ComponentType:s})}),r=await e.json();r.status?(g(null==r?void 0:r.data),o.oR.success("".concat(t," added Successfully")),c(!0)):("Page already exists with this title"==r.message?alert("School Name Already Taken"):alert(r.message),g({}))}catch(e){console.error("Error: ",e),o.oR.error("An error occurred while processing your request.")}finally{a.style.width="0%"}};return(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("div",{id:"progress-bar",className:"fixed top-0 left-0 h-1 bg-red-500 z-50"}),(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-600 via-purple-600 to-indigo-700 rounded-2xl p-6 mb-8 shadow-2xl",children:(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("div",{className:"bg-white/20 backdrop-blur-sm rounded-full p-3",children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-white",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),(0,a.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-novaBold text-white tracking-wide",children:["Create ",t]}),(0,a.jsxs)("p",{className:"text-blue-100 font-novaReg text-sm mt-1",children:["Add a ",null==t?void 0:t.toLowerCase()," page to your website structure"]})]})]})}),!d&&(0,a.jsx)("div",{className:"bg-white max-w-xl rounded-2xl shadow-xl p-8 border border-gray-100",children:(0,a.jsxs)("form",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"Name",className:"block text-sm font-novaSemi text-gray-700 mb-2",children:[t," Name",(0,a.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,a.jsx)("input",{id:"Name",type:"text",value:h,placeholder:"Enter ".concat(t," Name..."),onChange:e=>x(e.target.value),className:"w-full border-2 border-gray-200 font-novaReg rounded-xl py-3 px-4 focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-200 transition-all duration-200 bg-gray-50 hover:bg-white"}),f.Name&&(0,a.jsx)("p",{className:"text-sm text-red-600 ml-1 mt-1",children:f.Name})]}),(0,a.jsxs)("div",{className:"flex space-x-4 pt-6",children:[(0,a.jsx)("button",{onClick:w,type:"button",className:"flex-1 bg-gradient-to-r from-green-500 to-green-600 text-white py-3 px-6 rounded-xl font-novaSemi text-sm uppercase tracking-wide hover:from-green-600 hover:to-green-700 hover:scale-105 transform transition-all duration-200 shadow-lg hover:shadow-xl",children:(0,a.jsxs)("span",{className:"flex items-center justify-center space-x-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),(0,a.jsxs)("span",{children:["Add ",t]})]})}),(0,a.jsx)("button",{type:"button",onClick:()=>{c(!1),x(""),m(null)},className:"flex-1 bg-gradient-to-r from-red-500 to-red-600 text-white py-3 px-6 rounded-xl font-novaSemi text-sm uppercase tracking-wide hover:from-red-600 hover:to-red-700 hover:scale-105 transform transition-all duration-200 shadow-lg hover:shadow-xl",children:(0,a.jsxs)("span",{className:"flex items-center justify-center space-x-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),(0,a.jsx)("span",{children:"Clear Form"})]})})]})]})}),d&&(0,a.jsx)(l.default,{allData:p,parentPage:u,type:t,componentType:s})]})}},14173:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(14232),r=s(54196);function n(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!1),[o,l]=(0,a.useState)(!0),[i,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(""),[m,h]=(0,a.useState)("");return(0,a.useEffect)(()=>{var e;let s=null==(e=localStorage.getItem("admin_token"))?void 0:e.replaceAll('"',"");console.log(s),(async()=>{try{let a=await fetch("".concat(r.Qs,"admin/me"),{headers:{Authorization:"Bearer ".concat(s)},credentials:"include"}),o=await a.json();if(console.log(o),o.status){let s=(null==o?void 0:o.data)||{};"[email protected]"===s.email&&(s.role="IPMASTER"),h(s),n("SuperAdmin"===s.role),t(s.permissions||[]);let a=(s.permissions||[]).filter(e=>"Pages"===e.module);if("SuperAdmin"!==s.role&&(u(""),a.length>0)){var e;d(null==(e=a[0])?void 0:e.subModule)}u(s._id)}}catch(e){console.error("Permission fetch error:",e)}finally{l(!1)}})()},[]),{permissions:e,hasPermission:(t,a)=>{let r=e.find(e=>e.module===t);return!!s||(null==r?void 0:r.actions.includes(a))},loading:o,isSuperAdmin:s,submodules:i,adminId:c,adminData:m}}},51252:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/Components/CreateSchoolPages",function(){return s(584)}])},54196:(e,t,s)=>{"use strict";s.d(t,{CY:()=>n,Ir:()=>r,Qs:()=>a});let a="https://sea-lion-app-zhe9q.ondigitalocean.app/api/",r="https://mangalmay.sfo3.cdn.digitaloceanspaces.com",n="https://www.mangalmay.org/"}},e=>{e.O(0,[4e3,764,7740,7661,636,6593,8792],()=>e(e.s=51252)),_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.