1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[56618],{50939:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/offline-university/cutoff",function(){return n(71682)}])},98007:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var i=n(85893),a=n(67294),l=n(50788);function s(e){let{label:t,name:n,value:s,onChange:o,type:r="text",placeholder:c="",required:d=!1,error:f="",maxLength:u=1e4,rows:m=3,className:h="",labelClassName:x="",inputClassName:p="",errorClassName:v="",disabled:y=!1,readOnly:b=!1,icon:g=null,iconPosition:j="left",helperText:_="",autoFocus:N=!1,onBlur:w=null,onFocus:C=null,...k}=e,[A,S]=(0,a.useState)(!1),E="password"===r,O="textarea"===r,F=e=>{o&&o(e)},Z="w-full px-4 py-2 border rounded-lg\nfocus:outline-none\nfocus:ring-2\nfocus:ring-blue-500\nfocus:border-blue-500\ntransition-all duration-200\n".concat(f?"border-red-500":"border-gray-300","\n").concat(y?"bg-gray-100 cursor-not-allowed":"bg-white","\n").concat(g&&"left"===j?"pl-10":"","\n").concat(g&&"right"===j?"pr-10":"","\n").concat(E?"pr-10":"","\n").concat(p);return(0,i.jsxs)("div",{className:"mb-4 ".concat(h),children:[t&&(0,i.jsxs)("label",{htmlFor:n,className:"block text-sm font-medium text-gray-700 mb-2 ".concat(x),children:[t,d&&(0,i.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,i.jsxs)("div",{className:"relative",children:[g&&"left"===j&&(0,i.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:(0,i.jsx)("span",{className:"text-gray-500",children:g})}),O?(0,i.jsx)("textarea",{id:n,name:n,value:s||"",onChange:F,placeholder:c,rows:m,maxLength:u,disabled:y,readOnly:b,autoFocus:N,onBlur:w,onFocus:C,className:Z,...k}):(0,i.jsx)("input",{id:n,name:n,type:E?A?"text":"password":r,value:s||"",onChange:F,placeholder:c,maxLength:u,disabled:y,readOnly:b,autoFocus:N,onBlur:w,onFocus:C,className:Z,...k}),E&&(0,i.jsx)("button",{type:"button",onClick:()=>{S(!A)},className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-500 hover:text-gray-700 focus:outline-none",tabIndex:"-1",children:A?(0,i.jsx)(l.wqE,{size:20}):(0,i.jsx)(l.t2l,{size:20})}),g&&"right"===j&&!E&&(0,i.jsx)("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none",children:(0,i.jsx)("span",{className:"text-gray-500",children:g})})]}),_&&!f&&(0,i.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:_}),f&&(0,i.jsx)("p",{className:"mt-1 text-sm text-red-500 ".concat(v),children:f}),u&&s&&(0,i.jsxs)("div",{className:"mt-1 text-xs text-gray-400 text-right",children:[String(s).length,"/",u]})]})}},38741:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var i=n(85893),a=n(41664),l=n.n(a);function s(e){let{id:t}=e;return(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-6",children:[(0,i.jsx)(l(),{href:"/admin/offline-university",className:"px-3 py-1.5 rounded bg-gray-100 text-gray-700 hover:bg-gray-200 text-sm font-medium",children:"â Back"}),[{label:"Edit (About)",href:"/admin/offline-university/add?id=".concat(t),color:"blue"},{label:"Admission",href:"/admin/offline-university/admission?id=".concat(t),color:"green"},{label:"Fees",href:"/admin/offline-university/fees?id=".concat(t),color:"yellow"},{label:"CutOff",href:"/admin/offline-university/cutoff?id=".concat(t),color:"purple"},{label:"Ranking",href:"/admin/offline-university/ranking?id=".concat(t),color:"pink"},{label:"Scholarship",href:"/admin/offline-university/scholarship?id=".concat(t),color:"teal"},{label:"Placement",href:"/admin/offline-university/Placement?id=".concat(t),color:"cyan"},{label:"Facility",href:"/admin/offline-university/facility?id=".concat(t),color:"cyan"},{label:"Campus",href:"/admin/offline -university/campus?id=".concat(t),color:"lime"},{label:"Hostel",href:"/admin/offline-university/hostel?id=".concat(t),color:"rose"},{label:"FAQ",href:"/admin/offline-university/faq?id=".concat(t),color:"orange"}].map(e=>(0,i.jsx)(l(),{href:e.href,className:"px-3 py-1.5 rounded text-sm font-medium bg-".concat(e.color,"-50 text-").concat(e.color,"-600 hover:bg-").concat(e.color,"-100"),children:e.label},e.label))]})}n(11163)},71682:function(e,t,n){"use strict";n.r(t);var i=n(85893),a=n(67294),l=n(11163),s=n(86501),o=n(15122),r=n(98007),c=n(84977),d=n(34291),f=n(38741);t.default=function(){var e;let t=(0,l.useRouter)(),{id:n,universityId:u}=t.query,[m,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),[b,g]=(0,a.useState)({offline_university_id:u||"",title:"",new_description:"",cutoff_json:[{heading:"",cutoffs:[{title:"",value:""}]}],factors_json:[],cutoff_notes:"",meta_title:"",meta_description:""}),[j,_]=(0,a.useState)({});(0,a.useEffect)(()=>{n&&(p(!0),N(n))},[n,u]);let N=async e=>{y(!0);try{var t,i;let a=new d.default,l=await a.GetOfflineUniversityByID(e),o=(null==l?void 0:null===(i=l.data)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.cutoff)||(null==l?void 0:l.data);if(!o){s.default.error("University not found");return}let r=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},c=r(null==o?void 0:o.cutoff_json);if("string"==typeof c)try{c=JSON.parse(c)}catch(e){c=[]}Array.isArray(c)||(c=[c||{heading:"",cutoffs:[]}]),c=c.map(e=>({heading:(null==e?void 0:e.heading)||"",cutoffs:Array.isArray(null==e?void 0:e.cutoffs)?e.cutoffs:[]})),0===c.length&&(c=[{heading:"",cutoffs:[]}]),g({offline_university_id:n||"",title:o.title||"",new_description:o.new_description||"",cutoff_json:c,factors_json:r(null==o?void 0:o.factors_json)||[],cutoff_notes:o.cutoff_notes||"",meta_title:o.meta_title||"",meta_description:o.meta_description||""})}catch(e){console.error(e),s.default.error((null==e?void 0:e.message)||"Failed to fetch university")}finally{y(!1)}},w=e=>{let{name:t,value:n}=e.target;g(e=>({...e,[t]:n})),j[t]&&_(e=>({...e,[t]:""}))},C=(e,t)=>{g(n=>{let i=[...n.cutoff_json];return i[e].heading=t,{...n,cutoff_json:i}})},k=(e,t,n,i)=>{g(a=>{let l=[...a.cutoff_json];return l[e].cutoffs[t][n]=i,{...a,cutoff_json:l}})},A=e=>{g(t=>{let n=[...t.cutoff_json];return n[e].cutoffs.push({title:"",value:""}),{...t,cutoff_json:n}})},S=(e,t)=>{g(n=>{let i=[...n.cutoff_json];return i[e].cutoffs.splice(t,1),{...n,cutoff_json:i}})},E=e=>{g(t=>
1({...t,cutoff_json:t.cutoff_json.filter((t,n)=>n!==e)}))},O=(e,t)=>{g(n=>({...n,[e]:t})),j[e]&&_(t=>({...t,[e]:""}))},F=()=>{var e;let t={};return(null===(e=b.title)||void 0===e?void 0:e.trim())||(t.title="Title is required"),b.offline_university_id||(t.offline_university_id="University ID is required"),_(t),0===Object.keys(t).length},Z=async e=>{if(e.preventDefault(),F()){h(!0);try{let e=new d.default,i={offline_university_id:Number(n)||"",title:b.title||"",new_description:b.new_description||"",meta_title:b.meta_title||"",meta_description:b.meta_description||"",cutoff_json:b.cutoff_json||"",factors_json:b.factors_json||"",cutoff_notes:b.cutoff_notes||""},a=await e.AdminCutOffOfflineUniversity(n,i);if(a.status){var t;s.default.success((null==a?void 0:null===(t=a.data)||void 0===t?void 0:t.message)||"Admission saved!")}else s.default.error(a.message||"Operation failed")}catch(e){console.error(e),s.default.error(e.message||"Something went wrong")}finally{h(!1)}}};return v?(0,i.jsx)(o.Z,{children:(0,i.jsx)("div",{className:"min-h-screen p-6 bg-gray-50 flex items-center justify-center",children:(0,i.jsxs)("div",{className:"text-center",children:[(0,i.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto"}),(0,i.jsx)("p",{className:"mt-4 text-gray-600",children:"Loading cutoff data..."})]})})}):(0,i.jsx)(o.Z,{children:(0,i.jsxs)("div",{className:"min-h-screen p-6 bg-gray-50",children:[(0,i.jsx)("h1",{className:"text-2xl font-bold text-gray-800 mb-6",children:x?"Edit Cutoff":"Add Cutoff"}),n&&(0,i.jsx)(f.default,{id:n}),!u&&!x&&(0,i.jsx)("div",{className:"mb-4",children:(0,i.jsx)(r.Z,{label:"University ID",name:"offline_university_id",value:b.offline_university_id,onChange:w,placeholder:"Enter University ID",required:!0,error:j.offline_university_id,type:"number"})}),(0,i.jsx)(r.Z,{label:"Title",name:"title",value:b.title,onChange:w,placeholder:"Enter cutoff title (e.g., B.Tech Cutoff 2025)",required:!0,error:j.title,maxLength:255}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)(c.Z,{label:"Describe the cutoff criteria...",value:b.new_description,onChange:e=>O("new_description",e),fields:[{key:"description",label:"description",type:"richtext",required:!0}],placeholder:"Describe the cutoff criteria..."})}),(0,i.jsxs)("div",{className:"mt-6 space-y-6",children:[null==b?void 0:null===(e=b.cutoff_json)||void 0===e?void 0:e.map((e,t)=>(0,i.jsxs)("div",{className:"border rounded-lg p-5 bg-white shadow",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsxs)("h3",{className:"font-semibold",children:["Cutoff Section ",t+1]}),(0,i.jsx)("button",{type:"button",onClick:()=>E(t),className:"text-red-600",children:"Remove Section"})]}),(0,i.jsx)(r.Z,{label:"Heading",value:e.heading,onChange:e=>C(t,e.target.value)}),(0,i.jsxs)("div",{className:"mt-5",children:[e.cutoffs.map((e,n)=>(0,i.jsxs)("div",{className:"flex gap-3 mb-3",children:[(0,i.jsx)("input",{className:"flex-1 border rounded p-2",placeholder:"Exam Name",value:e.title,onChange:e=>k(t,n,"title",e.target.value)}),(0,i.jsx)("input",{className:"flex-1 border rounded p-2",placeholder:"Value",value:e.value,onChange:e=>k(t,n,"value",e.target.value)}),(0,i.jsx)("button",{type:"button",onClick:()=>S(t,n),className:"bg-red-100 px-3 rounded",children:"Remove"})]},n)),(0,i.jsx)("button",{type:"button",onClick:()=>A(t),className:"mt-2 px-4 py-2 bg-green-100 rounded",children:"+ Add Entry"})]})]},t)),(0,i.jsx)("button",{type:"button",onClick:()=>{g(e=>({...e,cutoff_json:[...e.cutoff_json,{heading:"",cutoffs:[{title:"",value:""}]}]}))},className:"px-5 py-2 bg-blue-600 text-white rounded",children:"+ Add Cutoff Section"})]}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)(c.Z,{label:"Factors Affecting Cutoff 2026",value:b.factors_json,onChange:e=>O("factors_json",e),fields:[{key:"description",label:"description",type:"richtext",required:!0}],placeholder:"Factors Affecting Cutoff 2026"})}),(0,i.jsx)("div",{className:"mt-6",children:(0,i.jsx)(r.Z,{label:"Cutoff factor Notes",name:"cutoff_notes",value:b.cutoff_notes,onChange:w,placeholder:"Additional notes",type:"textarea",rows:3})}),(0,i.jsx)(r.Z,{label:"meta title",name:"meta_title",value:b.meta_title,onChange:w,placeholder:"Enter meta title"}),(0,i.jsx)(r.Z,{label:"meta description",name:"meta_description",value:b.meta_description,onChange:w,placeholder:"Enter meta description",type:"textarea"}),(0,i.jsxs)("div",{className:"flex justify-end space-x-4 mt-8 pt-6 border-t",children:[(0,i.jsx)("button",{type:"button",onClick:()=>t.back(),className:"px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),(0,i.jsx)("button",{type:"button",onClick:Z,disabled:m,className:"px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium shadow-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:m?(0,i.jsxs)("span",{className:"flex items-center",children:[(0,i.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,i.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,i.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),x?"Updating...":"Saving..."]}):x?"Update Cutoff":"Save Cutoff"})]})]})})}}},function(e){e.O(0,[64838,76660,13365,60509,56130,34396,92729,41664,63872,77472,34291,15122,84977,92888,49774,40179],function(){return e(e.s=50939)}),_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.