1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[267],{33563:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/menuadmin",function(){return n(64213)}])},64224:function(e,t,n){"use strict";n.d(t,{$D:function(){return h},IU:function(){return o},Nq:function(){return p},YR:function(){return f},ej:function(){return u},uf:function(){return c},xJ:function(){return i}});var r=n(94301),a=n.n(r),s=n(31955),l=n(31838),o=function(e){return a()("".concat(l.bl,"/signup"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},i=function(e){return a()("".concat(l.bl,"/signin"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},c=function(e){return d("token"),m("user"),e(),a()("".concat(l.bl,"/signout"),{method:"GET"}).then((function(e){console.log("signout success")})).catch((function(e){return console.log(e)}))},d=function(e){s.Z.remove(e,{expires:1})},u=function(e){return s.Z.get(e)},m=function(e){localStorage.removeItem(e)},f=function(e,t){var n,r;n="token",r=e.token,s.Z.set(n,r,{expires:1}),function(e,t){localStorage.setItem(e,JSON.stringify(t))}("user",e.user),t()},h=function(){if(u("token"))return!!localStorage.getItem("user")&&JSON.parse(localStorage.getItem("user"))},p=function(e,t){if(localStorage.getItem("user")){var n=JSON.parse(localStorage.getItem("user"));n=e,localStorage.setItem("user",JSON.stringify(n)),t()}}},84195:function(e,t,n){"use strict";n.d(t,{BB:function(){return u},NH:function(){return m},Pl:function(){return h},hD:function(){return f},kd:function(){return d},tv:function(){return c}});var r=n(47568),a=n(34051),s=n.n(a),l=n(9669),o=n.n(l),i=n(31838),c=function(){var e=(0,r.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o().post(i.bl+"/".concat(n),t);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}(),d=function(){var e=(0,r.Z)(s().mark((function e(t,n,r){var a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o().put(i.bl+"/".concat(r,"/").concat(t),n);case 3:return a=e.sent,e.abrupt("return",a);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n,r){return e.apply(this,arguments)}}(),u=function(){var e=(0,r.Z)(s().mark((function e(t){var n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o().get(i.bl+"/".concat(t));case 3:return n=e.sent.data,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),m=function(){var e=(0,r.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o().get(i.bl+"/".concat(n,"/").concat(t));case 3:return r=e.sent.data,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}(),f=function(){var e=(0,r.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o().delete(i.bl+"/".concat(n,"/").concat(t));case 3:return r=e.sent,e.abrupt("return",r);case 7:e.prev=7,e.t0=e.catch(0),console.error("There was an error!",e.t0);case 10:case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}(),h=function(){var e=(0,r.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o().delete(i.bl+"/deleteSubject/".concat(t,"/").concat(n));case 3:return r=e.sent,e.abrupt("return",r);case 7:e.prev=7,e.t0=e.catch(0),console.error("There was an error!",e.t0);case 10:case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}()},85789:function(e,t,n){"use strict";var r=n(85893),a=n(67294),s=n(5152),l=n.n(s),o=n(9008),i=n.n(o),c=l()((function(){return Promise.all([n.e(3134),n.e(7440),n.e(7673)]).then(n.bind(n,37673))}),{loadableGenerated:{webpack:function(){return[37673]}},ssr:!1});t.Z=function(e){var t=e.children;return(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(i(),{children:[(0,r.jsx)("meta",{charset:"utf-8"}),(0,r.jsx)("link",{rel:"shortcut icon",href:"/static/admin/preview/favicon.ico"}),(0,r.jsx)("meta",{name:"viewport",content:"width=device-width,initial-scale=1"}),(0,r.jsx)("meta",{name:"theme-color",content:"#000000"}),(0,r.jsx)("meta",{name:"description",content:"Web site created using create-react-app"}),(0,r.jsx)("link",{rel:"apple-touch-icon",href:"logo192.png"}),(0,r.jsx)("title",{children:"Dashboard"}),(0,r.jsx)("link",{rel:"styles",href:"public/assets/scss/admin/main.d227dcc7.chunk.css"})]}),(0,r.jsx)(c,{}),t]})}},69422:function(e,t,n){"use strict";var r=n(85893);n(67294);t.Z=function(){return(0,r.jsx)(r.Fragment,{})}},46960:function(e,t,n){"use strict";var r=n(85893),a=n(67294),s=n(11163),l=n.n(s),o=n(64224);t.Z=function(e){var t=e.children;return(0,a.useEffect)((function(){(0,o.$D)()?0==(0,o.$D)().role&&l().push("/admin/menuadmin"):l().push("/signin")}),[]),(0,r.jsx)(a.Fragment,{children:t})}},31838:function(e,t,n){"use strict";n.d(t,{bl:function(){return a},f6:function(){return i},iC:function(){return s},t4:function(){return o},yK:function(){return l}});var r=(0,n(11752).default)().publicRuntimeConfig,a=r.PRODUCTION?r.API_PRODUCTION:r.API_DEVELOPMENT,s=r.APP_NAME,l=r.PRODUCTION?r.DOMAIN_PRODUCTION:r.DOMAIN_DEVELOPMENT,o=r.PRODUCTION?r.UPLOADS_URL_PRODUCTION:r.UPLOADS_URL_DEVELOPMENT,i=r.FB_APP_ID},48454:function(e,t,n){"use strict";n.d(t,{$:function(){return a},J:function(){return r}});var r={toolbar:[[{align:""},{align:"center"},{align:"right"},{align:"justify"}],[{header:"1"},{header:"2"},{header:[3,4,5,6]},{font:[]}],[{size:[]}],[{color:[]},{background:[]}],["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link","image","video"],["clean"],["code-block"]]},a=["header","align","font","size","color","background","bold","italic","underline","strike","blockquote","list","bullet","link","image","video","code-block"]},64213:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Pt}});var r=n(85893),a=n(67294),s=n(9473),l=n(85789),o=n(46960),i=n(26042),c=n(69396),d=n(99534),u=n(41664),m=n.n(u),f=n(64224),h=n(47568),p=n(34051),x=n.n(p),b=n(94301),j=n.n(b),g=n(31838),v=(function(){var e=(0,h.Z)(x().mark((function e(t){var n,r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.stringify(t),console.log("JSON data received",n),e.prev=2,e.next=5,j()("".concat(g.bl,"/newmenu"),{method:"POST",headers:{Accept:"application/json","Content-type":"application/json"},body:n});case 5:return r=e.sent,e.next=8,r.json();case 8:return e.abrupt("return",e.sent);case 11:return e.prev=11,e.t0=e.catch(2),e.abrupt("return",console.log(e.t0));case 14:case"end":return e.stop()}}),e,null,[[2,11]])})))}(),n(16518)),N=n(92814),y=n(65494),S=n.n(y),C=n(18384),w=n(95862),Z=n(87536),D=n(64769),I=n(35005),F=n(22920),k=n(9669),M=n.n(k),A=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),n=JSON.stringify(t),e.prev=2,e.next=5,M().post(g.bl+"/subMenuGroup",n,{headers:{"Content-type":"application/json"}});case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),e.t0;case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));return function(t){return e.apply(this,arguments)}}(),T=function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t,n),r=JSON.stringify(t),console.log("data in axios after stringify",r,n),e.prev=3,e.next=6,M().put(g.bl+"/subMenuGroup/".concat(n),r,{headers:{"Content-type":"application/json"}},console.log("data sent from axios",r));case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),e.t0;case 11:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(t,n){return e.apply(this,arguments)}}(),B=function(){var e=(0,h.Z)(x().mark((function e(){var t;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/subMenuGroups");case 3:return t=e.sent.data,e.abrupt("return",t);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),E=(function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().post(g.bl+"/data
1Files",{dataID:t,fileGroup:n});case 3:return r=e.sent.data,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/subMenuGroup/".concat(t));case 3:return n=e.sent.data,console.log("received data",n),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}()),_=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().delete(g.bl+"/subMenuGroup/".concat(t));case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 11:case 12:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),O=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/getsubMenuGroupByName/".concat(t));case 3:return n=e.sent.data,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();var q=function(e){var t=e.openModal,n=e.handleClose,s=(e.handleForm,e.isAddMode,e.menuitem),l=(s.menuName,s.hasSubMenu,s.subMenutype,s.order,s.formData,s.parent,s.subMenuGroup),o=(s.children,(0,a.useState)({})),c=o[0],d=o[1],u=(0,a.useState)(!1),m=u[0],f=u[1],h=e.menuitem._id,p=(0,Z.cI)({defaultValues:{menuName:"",menuDisplayName:"",subMenuGroup:e.menuitem.subMenuGroup,order:1,parentMenuId:e.menuitem.parent,groupRootId:""}}),x=(p.setError,p.watch,p.register),b=p.handleSubmit,v=(p.control,p.reset,p.setValue,p.formState,p.formState.errors);return console.log("submenugroup",l),(0,a.useEffect)((function(){O(l).then((function(e){console.log("root menu data in use effect function data",e),d(e)}))}),[]),console.log("Submenu group groupmenu data",c),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{show:t,onHide:n,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:"Add New Group Sub Menu"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:b((function(t){f(!0),console.log("Submission Verified,",t),t.parentMenuId=h,t.groupRootId=c._id,t.groupRootName=c.menuName,t.isDeptBody=c.isDeptBody,(null===t.menuDisplayName||""===t.menuDisplayName)&&(t.menuDisplayName=t.menuName),console.log("Submission Verified2,",t),function(e){console.log("data received",e);var t=JSON.stringify(e);return console.log("JSON data received",t),j()("".concat(g.bl,"/createGroupSubmenus"),{method:"POST",headers:{Accept:"application/json","Content-type":"application/json"},body:t}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))}(t).then((function(t){t.error?(f(!1),F.Am.error("Add Group Submenu Failed",err)):(F.Am.success("Group Submenu Added"),console.log("data saved",t),f(!1),e.handleClose())}))})),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Item"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Menu Item",type:"text",placeholder:"Menu Name"},x("menuName",{required:!0,maxLength:80}))),v.menuName&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),"Department"===c.menuName&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Dept.Display Name"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"menuDisplayName",type:"text",placeholder:"menuDisplayName"},x("menuDisplayName",{required:!0,maxLength:80}))),v.menuDisplayName&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Order By"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",placeholder:"order"},x("order",{})))]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("button",{disabled:m,type:"submit",className:"btn btn-primary",children:[m&&(0,r.jsx)("span",{className:"spinner-grow spinner-grow-sm"}),"Save"]}),(0,r.jsx)(I.Z,{variant:"danger",type:"submit",className:"ml-5",onClick:function(){return n()},children:"Close"})]})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})},R=n(28547),H=n(15993),P=(n(11540),function(){return function(){var e=(0,h.Z)(x().mark((function e(t){var n,r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(){var e=(0,h.Z)(x().mark((function e(){var t,n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j()("".concat(g.bl,"/newmenus"),{method:"GET"});case 2:if((t=e.sent).ok){e.next=5;break}throw new Error("Could not fetch menu data!");case 5:return e.next=7,t.json();case 7:return n=e.sent,e.abrupt("return",n);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=1,e.next=4,n();case 4:r=e.sent,t(H.b.replaceMenu({items:r||[]})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),t(R.A.showNotification({status:"error",title:"Error!",message:"Fetching menu data failed!"}));case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()}),G=function(e,t){return console.log("Menu received in createNewMenu",e),function(){var t=(0,h.Z)(x().mark((function t(n){var r,a;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n(R.A.showNotification({status:"pending",title:"Sending...",message:"Sending menu form data!"})),r=function(){var e=(0,h.Z)(x().mark((function e(t){var n,r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j()("".concat(g.bl,"/newmenu"),{method:"POST",headers:{Accept:"application/json","Content-type":"application/json"},body:JSON.stringify(t)});case 2:if((n=e.sent).ok){e.next=5;break}throw new Error("Could not fetch menu data!");case 5:return e.next=7,n.json();case 7:return r=e.sent,e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.prev=2,t.next=5,r(e);case 5:a=t.sent,console.log("Menu created... going to dispatch",a.data.menu),a.data.menu,t.next=13;break;case 10:t.prev=10,t.t0=t.catch(2),n(R.A.showNotification({status:"error",title:"Error!",message:"Fetching menu form data failed!"}));case 13:n(P()),n(R.A.showNotification({status:"success",title:"Success!",message:"Sent menu data successfully!"}));case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}()};function L(e){var t,n=function(e){document.querySelector("#sidebar").classList.remove("active"),Array.isArray(y)&&(j((function(e){return!e})),console.log("collapsed item",f.menuName,b)),f.hasSubMenu||p(w.T.replaceSelMenu({item:f||{}}))},l=e.depthStep,o=void 0===l?10:l,u=e.depth,m=void 0===u?0:u,f=(e.expanded,e.item),h=(0,d.Z)(e,["depthStep","depth","expanded","item"]),p=(0,s.I0)(),x=(0,a.useState)(!0),b=x[0],j=x[1],g=((0,s.v9)((function(e){return e.selmenu.selitem})),f.menuName),N=f.hasSubMenu,y=f.children,S=f.isSubMenuGroup,C=(f.subMenuGroup,(0,a.useState)(!1)),Z=C[0],D=C[1];return N&&(t=b?(0,r.jsx)("i",{className:"mdi mdi-chevron-left ml-auto"}):(0,r.jsx)("i",{className:"mdi mdi-chevron-down ml-auto"})),(0,r.jsxs)(r.Fragment,{children:[N?(0,r.jsxs)("li",{className:"nav-item",children:[(0,r.jsxs)("div",(0,c.Z)((0,i.Z)({className:"nav-link",onClick:n},h),{children:[(0,r.jsx)("span",{className:"menu-title w-100",children:g}),S&&(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-inverse-success p-0 px-2 ml-2",onClick:function(){p(w.T.replaceSelMenu({item:f||{}})),D(!0)},children:"New"}),t]})),(0,r.jsx)(v.Z,{in:!b,unmountOnExit:!0,children:Array.isArray(y)?(0,r.jsx)("ul",{className:"nav flex-column sub-menu",children:y.map((function(e,t){return(0,r.jsx)(a.Fragment,{children:(0,r.jsx)(L,{depth:m+1,depthStep:o,item:e})},"".concat(e.menuName).concat(t))}))}):null})]}):(0,r.jsx)("li",{className:"nav-item",children:(0,r.jsx)("a",{className:"nav-link",children:(0,r.jsx)("span",{className:"menu-title",onClick:n,children:g})})}),Z?(0,r.jsx)(q,{handleClose:function(){D(!1),p(P())},openModal:Z,menuitem:f}):null]})}var U=function(e){var t=e.newmenus,n=e.depthStep,l=e.depth,o=e.expanded,i=(0,s.I0)();return(0,r.jsx)("div",{className:S().sidebar,children:(0,r.jsx)("nav",{className:"sidebar sidebar-offcanvas",id:"sidebar",children:(0,r.jsxs)("ul",{className:"nav customscroll",style:{height:"100vh",overflow:"auto"},children:[(0,r.jsx)("li",{className:"nav-item",children:(0,r.jsxs)("a",{onClick:function(e){i(w.T.replaceSelMenu({item:{menuName:"Home",hasSubMenu:!1,formCategory:{value:"DashBoard",label:"Dashboard"}}||{}}))},className:"nav-link",children:[(0,r.jsx)("span",{className:"menu-title w-100",children:"Dashboard"}),(0,r.jsx)("i",{className:"mdi mdi-home menu-icon"})]})}),t.map((function(e,t){return(0,r.jsx)(a.Fragment,{children:(0,r.jsx)(L,{depthStep:n,depth:l,expanded:o,item:e})},"".concat(e.menuName).concat(t))})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("li",{className:"nav-item",children:(0,r.jsxs)("a",{className:"nav-link",onClick:function(e){i(w.T.replaceSelMenu({item:{menuName:"Home",hasSubMenu:!1,formCategory:{value:"ManageMenu",label:"ManageMenu"}}||{}}))},children:[(0,r.jsx)("span",{className:"menu-title w-100",children:"Manage Menu"}),(0,r.jsx)("i",{className:"mdi mdi-home menu-icon"})]})}),(0,r.jsx)(C.Z.Item,{className:S().menuitem,children:(0,r.jsx)("div",{className:S().sidebaritemtext,onClick:function(e){i(w.T.replaceSelMenu({item:{menuName:"Home",hasSubMenu:!1,formCategory:{value:"SubMenuGroup",label:"SubMenuGroup"}}||{}}))},children:"Manage Submenu Groups"})}),(0,r.jsx)(C.Z.Item,{className:S().menuitem,children:(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:S().sidebaritemtext,onClick:function(e){i(w.T.replaceSelMenu({item:{menuName:"Home",hasSubMenu:!1,formCategory:{value:"EntryForms",label:"EntryForms"}}||{}}))},children:"Manage Entry Forms"})})})]})]})})})},V=n(5152),W=n.n(V),z=function(e){console.log("data received in action",e.title);var t=JSON.stringify(e);return j()("".concat(g.bl,"/sitedata"),{method:"POST",headers:{Accept:"application/json","Content-type":"application/json"},body:t}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},Q=function(e){return console.log("getsitedataby mid",e),j()("".concat(g.bl,"/SiteDataBymasterID/").concat(e),{method:"GET"}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},Y=function(e){return j()("".concat(g.bl,"/sitedata/").concat(e),{method:"GET"}).then((function(e){return console.log("data fetched in controller"),e.json()})).catch((function(e){return console.log(e)}))},J=function(e,t){return console.log("data in actions fetch",t,e),j()("".concat(g.bl,"/sitedata/").concat(t),{method:"PUT",headers:{Accept:"application/json","Content-type":"application/json"},body:JSON.stringify(e)}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},X=function(e){return j()("".concat(g.bl,"/sitedata/").concat(e),{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json"}}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},$=function(e){return j()("".concat(g.bl,"/ToggleSiteDataIsActive/").concat(e),{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"}}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))},K=function(){var e=(0,h.Z)(x().mark((function e(t,n,r){var a;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.log("data in actions for axios",t,n,r),e.next=4,M().get(g.bl+"/DownloadItemsFiltered/".concat(t,"/").concat(n,"/").concat(r));case 4:return a=e.sent.data,e.abrupt("return",a);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,n,r){return e.apply(this,arguments)}}(),ee=n(9198),te=n.n(ee),ne=n(51436),re=(n(18698),function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().post(g.bl+"/data
1Files",t,n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}()),ae=function(){var e=(0,h.Z)(x().mark((function e(t,n,r){var a;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().put(g.bl+"/dataFile/".concat(t),n,r);case 3:return a=e.sent,e.abrupt("return",a);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n,r){return e.apply(this,arguments)}}(),se=(function(){var e=(0,h.Z)(x().mark((function e(){var t;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/dataFiles");case 3:return t=e.sent.data,e.abrupt("return",t);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/dataFilesByDataId/".concat(t,"/").concat(n));case 3:return r=e.sent.data,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n){return e.apply(this,arguments)}}()),le=(function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/dataFile/".concat(t));case 3:return n=e.sent.data,console.log("received data",n),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().delete(g.bl+"/dataFile/".concat(t));case 3:return e.abrupt("return",response);case 6:e.prev=6,e.t0=e.catch(0),console.error("There was an error!",e.t0);case 9:case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}()),oe=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),n=JSON.stringify(t),e.prev=2,e.next=5,M().post(g.bl+"/dataLinks",n,{headers:{"Content-type":"application/json"}});case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),e.t0;case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));return function(t){return e.apply(this,arguments)}}(),ie=function(){var e=(0,h.Z)(x().mark((function e(t,n){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().put(g.bl+"/dataLink/".concat(t),n);case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),e.t0;case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t,n){return e.apply(this,arguments)}}(),ce=(function(){var e=(0,h.Z)(x().mark((function e(){var t;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/dataLinks");case 3:return t=e.sent.data,e.abrupt("return",t);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/dataLink/".concat(t));case 3:return n=e.sent.data,console.log("received data",n),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/dataLinks/".concat(t));case 3:return n=e.sent.data,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()),de=n(95774),ue=(n(86422),n(23855)),me=function(e){e.getdataFile;var t=e.onSubmit,n=e.fileMasterID,s=e.fileDataID,l=e.fileModelRef,o=e.fileContID,c=(e.fileDate,e.imageModal),d=e.isAddMode,u=e.handleClose,m=e.datatitle,f=(e.editImageID,e.editCaption),h=e.editFile,p=e.fileGroup,x=(0,a.useState)(h),b=x[0],j=(x[1],(0,a.useState)(0)),g=j[0],v=j[1],N=(0,a.useState)(""),y=(N[0],N[1],(0,Z.cI)({defaultValues:{fileCaption:"",fileCategory:"",fileTag:"",fileDate:""}})),S=(y.setError,y.watch,y.register),C=y.handleSubmit,w=y.control,I=y.reset,k=y.setValue,M=(y.formState,y.formState.errors);(0,a.useEffect)((function(){if(!d){["fileCaption","fileTag","fileCategory","fileDataID","fileMasterID","fileName","fileOrder"].forEach((function(e){return k(e,b[e])}));var e=(0,ue.default)(b.fileDate);k("fileDate",e)}}),[b]);var A={onUploadProgress:function(e){var t=e.loaded,n=e.total,r=Math.floor(t/1e3*100/(n/1e3));v(r)}},T=function(e){var r="",a="1";console.log("data before file order set",e);var i=e.fileOrder;"img"===p?r="singleimage":"pdf"===p&&(r="pdf"),""===i||null===i||void 0===i?(a="1",console.log("datafileorder in null option and set as 1")):a=e.fileOrder;var c=h._id;h.filePath;e.MasterID=n,e.DataID=s,e.ContID=o,e.fileModelRef=l;var u=new FormData;
1u.append("file",e.file[0]),u.append("MasterID",e.MasterID),u.append("DataID",e.DataID),u.append("fileModelRef",l),u.append("ContID",e.ContID),u.append("fileCaption",e.fileCaption),u.append("fileCategory",e.fileCategory),u.append("fileTag",e.fileCategory),u.append("fileGroup",r),u.append("fileDate",e.fileDate),u.append("fileOrder",a),console.log("data after file order set data",e),console.log("new file order datafileorder",i),console.log("data after file order set newfileorder",a),d?re(u,A).then((function(e){console.log("response data",e.data),console.log("response status",e.status),I(),t(),F.Am.success("File is uploaded")})).catch((function(e){console.log(e),F.Am.error("Upload Failed",e)})):(u.append("fileName",h.fileName),u.append("PrevFilePath",h.filePath),ae(c,u,A).then((function(e){F.Am.success("File is updated"),I(),t()})).catch((function(e){console.log(e),F.Am.error("Update Failed",e)})))};return(0,r.jsxs)(D.Z,{show:c,dialogClassName:"modal-xl",onHide:u,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:d?"Add Images - ".concat(m):"Edit Image - ".concat(f)})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsx)("div",{className:"row mt-3",children:(0,r.jsx)("form",{onSubmit:C((function(e){if(e.file.length>0){var t=e.file[0].type,n=e.file[0].type.split("/")[1];"img"===p?"image/png"===t||"image/jpg"===t||"image/jpeg"===t||"image/gif"===t?T(e):alert("Not an image file .... please select image file"):"pdf"===p?"pdf"===n?T(e):alert("Not a pdf file .... please select pdf file only"):alert("File Type not defined")}else T(e)})),children:(0,r.jsxs)("div",{className:"col-12",children:[(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-lg-6 border p-4",children:(0,r.jsx)("div",{className:"form-group",children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel w-100",children:"Select files "}),(0,r.jsx)("input",(0,i.Z)({label:"Select Image",type:"file",placeholder:"No Image Selected"},S("file",{required:!0}))),M.file&&(0,r.jsx)("span",{style:{color:"red"},children:"Image is required"})]}):(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsx)("label",{children:"Select File \xa0\xa0\xa0\xa0\xa0"}),(0,r.jsx)("span",{className:"fw-bold",style:{color:"blue"},children:h.fileName}),(0,r.jsx)("input",(0,i.Z)({label:"Select Image",type:"file",placeholder:"No Image Selected"},S("file",{required:!1}))),M.file&&(0,r.jsx)("span",{style:{color:"red"},children:"Image is required"})]})})}),(0,r.jsx)("div",{className:"col-lg-12 mt-3",children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-lg-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",children:"Caption"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Image Caption",type:"text",placeholder:"Image Caption"},S("fileCaption",{required:"Image Caption Required"}))),M.fileCaption&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"date",children:"Date"}),(0,r.jsx)(Z.Qr,{control:w,name:"fileDate",rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(te(),{dateFormat:"dd-MM-yyyy",placeholderText:"Select date",onChange:function(e){return t.onChange(e)},selected:t.value,className:"form-control"})}}),M.fileDate&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]},"fileDate")]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",children:"Tags"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Image Tag",type:"text",placeholder:"Image Tag"},S("fileTag")))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",children:"Others"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Image Category",type:"text",placeholder:"Image Category"},S("fileCategory")))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"fileOrder",type:"text",placeholder:"Order"},S("fileOrder")))]})]})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col-lg-12 text-center",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary me-3",children:d?"Upload":"Update"}),(0,r.jsx)("button",{type:"submit",className:"btn btn-danger",onClick:e.handleClose,children:"Close"}),(0,r.jsx)("div",{className:"col-1 float-end",children:(0,r.jsx)(de.Ip,{value:g,text:"".concat(g,"%"),styles:(0,de.y3)({rotation:.25,strokeLinecap:"butt",textSize:"20px",pathTransitionDuration:.5,pathColor:"rgba(255, 136, 136, ".concat(g/100,")"),textColor:"#f88",trailColor:"#d6d6d6",backgroundColor:"#3e98c7"})})})]})})]})})})})]})},fe=n(828),he=n(96120),pe=n.n(he);n(51919);function xe(e){var t=function(e,t,n){var r=document.createElement("canvas"),a=e.naturalWi
1dth/e.width,s=e.naturalHeight/e.height;return r.width=t.width*a,r.height=t.height*s,r.getContext("2d").drawImage(e,t.x*a,t.y*s,t.width*a,t.height*s,0,0,t.width*a,t.height*s),new Promise((function(e,t){r.toBlob((function(r){if(r){r.name=n;var a=window.URL.createObjectURL(r);e([r,a])}else t(new Error("Canvas is empty"))}),"image/jpeg")}))},n=e.imageToCrop,s=e.onImageCropped,l=e.aspectwidth,o=e.aspectheight,i=(0,a.useState)({unit:"px",width:100,aspect:l/o}),c=i[0],d=i[1],u=(0,a.useState)(),m=u[0],f=u[1];function p(){return(p=(0,h.Z)(x().mark((function e(n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(m&&n.width&&n.height)){e.next=5;break}return e.next=3,t(m,n,"croppedImage.jpeg");case 3:r=e.sent,s(r);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"please select image and choose crop area "}),(0,r.jsx)(pe(),{src:n,crop:c,ruleOfThirds:!0,onImageLoaded:function(e){return f(e)},onComplete:function(e){return function(e){return p.apply(this,arguments)}(e)},onChange:function(e){return d(e)}})]})}xe.defaultProps={onImageCropped:function(){}};var be=xe,je=function(e){e.getdataFile;var t=e.onSubmit,n=e.fileMasterID,s=e.fileDataID,l=e.fileModelRef,o=e.fileContID,c=e.croppedImageModal,d=e.isAddMode,u=e.handleClose,m=e.dataTitle,f=(e.editImageID,e.editCaption),h=e.editFile,p=(e.fileGroup,e.cropWidth),x=e.cropHeight,b=(0,a.useState)(h),j=b[0],g=(b[1],(0,a.useState)(0)),v=g[0],N=g[1],y=(0,a.useState)(void 0),S=y[0],C=y[1],w=(0,a.useState)(void 0),I=w[0],k=w[1],M=(0,a.useState)(void 0),A=M[0],T=M[1],B=(0,a.useState)(""),E=B[0],_=B[1],O=(0,Z.cI)({defaultValues:{fileCaption:"",fileCategory:"",fileTag:"",fileDate:""}}),q=(O.setError,O.watch,O.register),R=O.handleSubmit,H=O.control,P=O.reset,G=O.setValue,L=(O.formState,O.profile,O.formState.errors);(0,a.useEffect)((function(){if(!d){["fileCaption","fileTag","fileCategory","fileDataID","fileMasterID","fileName"].forEach((function(e){return G(e,j[e])}));var e=(0,ue.default)(j.fileDate);G("fileDate",e)}}),[j]);var U={onUploadProgress:function(e){var t=e.loaded,n=e.total,r=Math.floor(t/1e3*100/(n/1e3));N(r)}},V=function(e){if(_(e.target.files[0].name),console.log("on Upload file working...set Image Name",E),e.target.files&&e.target.files.length>0){var t=new FileReader;t.addEventListener("load",(function(){return C(t.result)})),t.readAsDataURL(e.target.files[0])}};return(0,r.jsxs)(D.Z,{show:c,dialogClassName:"modal-xl",onHide:u,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{className:"text-center",children:(0,r.jsxs)(D.Z.Title,{className:"w-100",children:[(0,r.jsx)("button",{onClick:u,type:"button",className:"btn btn-danger btn-sm float-end",children:(0,r.jsx)("i",{className:"mdi mdi-close"})}),(0,r.jsx)("h4",{children:d?"Add Image":"Edit Image"}),(0,r.jsx)("p",{children:"".concat(d?m:f)}),(0,r.jsx)("hr",{})]})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("div",{className:"container",children:[(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("form",{onSubmit:R((function(e){var r=1,a=e.fileorder;r=""===a||null===a||void 0===a?1:e.fileorder;var i=h._id;h.filePath;console.log("formdata new after file order",e),e.MasterID=n,e.DataID=s,e.ContID=o,e.fileModelRef=l;var c=new FormData;if(c.append("MasterID",e.MasterID),c.append("DataID",e.DataID),c.append("ContID",e.ContID),c.append("fileModelRef",l),c.append("fileCaption",e.fileCaption),c.append("fileCategory",e.fileCategory),c.append("fileTag",e.fileCategory),c.append("fileGroup","croppedimage"),c.append("fileDate",e.fileDate),c.append("fileOrder",r),A){var u=new File([A],E,{type:A.type});console.log("imageto to crop file name",E),console.log("imageto New Image",u),c.append("file",u)}d?(re(c,U).then((function(e){F.Am.success("File is uploaded")})).catch((function(e){console.log(e),F.Am.error("Upload Failed",e)})),P(),t()):(c.append("fileName",h.fileName),c.append("PrevFilePath",h.filePath),ae(i,c,U),P(),t())})),children:[(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-lg-6 border p-4",children:[(0,r.jsx)("div",{className:"form-group",id:"select-file",children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("label",{className:"formlabel w-100",children:[(0,r.jsx)("i",{className:"flaticon-download"})," Upload New Image"]}),(0,r.jsx)("input",{className:"mb-3",label:"Select Image",type:"file",placeholder:"No Image Selected",onChange:V}),L.file&&(0,r.jsx)("span",{style:{color:"red"},children:"Image is required"})]}):(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsx)("label",{children:"Select File \xa0\xa0\xa0\xa0\xa0"}),(0,r.jsx)("span",{className:"fw-bold",style:{color:"blue"},children:h.fileName}),(0,r.jsx)("input",{className:"form-control",label:"Select Image",type:"file",placeholder:"No Image Selected",onChange:V}),L.file&&(0,r.jsx)("span",{style:{color:"red"},children:"Image is required"})]})}),(0,r.jsx)("div",{className:"w-75",id:"image-crop",children:(0,r.jsx)(be,{imageToCrop:S,onImageCropped:function(e){var t=(0,fe.Z)(e,2),n=t[0],r=t[1];k(r),T(n),console.log("image image blob",n)},aspectwidth:p,aspectheight:x})})]}),(0,r.jsx)("div",{className:"col-lg-6 ",children:I&&(0,r.jsx)("img",{className:"cropped-image",alt:"Cropped Img",src:I})})]})}),(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-lg-6",children:[(0,r.jsxs)("div",{className:"form-group mt-3",children:[(0,r.jsx)("label",{className:"formlabel",children:"Image Caption"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Image Caption",type:"text",placeholder:"Image Caption"}
1,q("fileCaption",{required:"Image Caption Required"}))),L.fileCaption&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",children:"Image Tags"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Image Tags",type:"text",placeholder:"Image Tag"},q("fileTag")))]})]}),(0,r.jsx)("div",{className:"col-lg-6",children:(0,r.jsxs)("div",{className:"form-group mt-3",children:[(0,r.jsx)("label",{className:"formlabel",children:"Image Details"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Image Details",type:"text",placeholder:"Image Category"},q("fileCategory")))]})}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"date",children:"Date"}),(0,r.jsx)(Z.Qr,{control:H,name:"fileDate",render:function(e){var t=e.field;return(0,r.jsx)(te(),{dateFormat:"dd-MM-yyyy",placeholderText:"Select date",onChange:function(e){return t.onChange(e)},selected:t.value})}}),L.dateInput&&(0,r.jsx)("span",{children:"This field is required"})]},"fileDate")]})}),(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-lg-12 text-center",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary",children:d?"Upload":"Update"}),(0,r.jsx)("button",{type:"submit",className:"btn btn-danger ms-3",onClick:e.handleClose,children:"Close"})]}),(0,r.jsx)("div",{className:"col-2 d-none",children:(0,r.jsx)(de.Ip,{value:v,text:"".concat(v,"%"),styles:(0,de.y3)({rotation:.25,strokeLinecap:"butt",textSize:"20px",pathTransitionDuration:.5,pathColor:"rgba(255, 136, 136, ".concat(v/100,")"),textColor:"#f88",trailColor:"#d6d6d6",backgroundColor:"#3e98c7"})})})]})})]})})}),(0,r.jsx)("div",{className:"col-6"})]})})]})},ge=function(e){e.getdataFile;var t=e.onSubmit,n=e.fileMasterID,s=e.fileDataID,l=e.fileModelRef,o=e.fileContID,c=e.linkModal,d=e.isAddMode,u=e.handleClose,m=e.datatitle,f=e.editCaption,h=e.editFile,p=(e.editFileId,(0,a.useState)(h)),x=p[0],b=(p[1],(0,Z.cI)({defaultValues:{fileCaption:"",fileCategory:"",fileTag:"",fileLink:""}})),j=(b.setError,b.watch,b.register),g=b.handleSubmit,v=(b.control,b.reset),N=b.setValue,y=(b.formState,b.formState.errors);(0,a.useEffect)((function(){if(!d){["fileCaption","fileTag","fileCategory","fileDataID","fileMasterID","fileLink","fileGroup"].forEach((function(e){return N(e,x[e])}))}}),[x]);return(0,r.jsxs)(D.Z,{show:c,onHide:u,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:d?"Add Images - ".concat(m):"Edit Image - ".concat(f)})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsx)("div",{className:"row mt-3",children:(0,r.jsx)("form",{onSubmit:g((function(e){var r=h._id;e.fileMasterID=n,e.fileDataID=s,e.fileDataID=o,e.fileModelRef=l,e.fileGroup="links",d?(oe(e).then((function(e){v(),t(),F.Am.success("Link is uploaded")})).catch((function(e){console.log(e),F.Am.error("Upload Link Failed",e)})),v(),t()):(ie(r,e).then((function(e){v(),t(),F.Am.success("Link is updated")})).catch((function(e){console.log(e),F.Am.error("Update Link Failed",e)})),v(),t())})),children:(0,r.jsxs)("div",{className:"col-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",children:"Link Caption"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Link Caption",type:"text",placeholder:"Link Caption"},j("fileCaption",{required:"Image Caption Required"}))),y.fileCaption&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{children:"Image Tag"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Link Tag",type:"text",placeholder:"Link Tag"},j("fileTag")))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{children:"Image Category"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Link Category",type:"text",placeholder:"Link Category"},j("fileCategory")))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{children:"Link"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Link",type:"url",placeholder:"Link"},j("fileLink")))]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col-10",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary",children:d?"Upload":"Update"}),(0,r.jsx)("button",{type:"submit",className:"btn btn-danger",onClick:e.handleClose,children:"Close"})]})})]})})})})]})};var ve=function(e){var t=e.imgFiles,n=e.cropFiles,a=e.pdfFiles,s=e.linkFiles,l=e.handleEdit,o=e.deleteConfirm,i=(0,r.jsx)("i",{className:"mdi mdi-delete-forever"}),c=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"});return(0,r.jsxs)(r.Fragment,{children:[t&&t.length>0&&(0,r.jsx)(r.Fragment,{children:t.map((function(e,t){return(0,r.jsx)("div",{className:"col-lg-3 col-md-4 mt-4",children:(0,r.jsxs)("div",{className:"for_blog feat_property",children:[(0,r.jsx)("div",{className:"thumb adminthumb",children:(0,r.jsx)("img",{className:"img-whp",src:"".concat(g.t4,"/uploads/thumbs/").concat(e.fileNewName),alt:"img"})}),(0,r.jsxs)("div",{className:"details",children:[(0,r.jsx)("div",{className:"tc_content",children:(0,r.jsxs)("h5",{className:"text-center",children:["File Name : ",e.fileCaption]})}),(0,r.jsxs)("div",{className:"fp_footer",children:[(0,r.jsx)("ul",{className:"fp_meta float-start mb0",children:(0,r.jsx)("li",{className:"list-inline-item pt-2",children:e.fileSize})}),(0,r.jsxs)("ul",{className:"fp_meta float-end mb0",children:[(0,r.jsx)("li",{className:"list-inline-item",children:(0,r.jsx)("button",{onClick:function(){return l(e)},className:"btn btn-inverse-info py-1 px-2",children:c})}),(0,r.jsx)("li",{className:"list-inline-item m-0",children:(0,r.jsx)("button",{onClick:function(){return o(e._id,e.fileCaption)},className:"btn btn-inverse-danger py-1 px-2 ",children:i})})]})]})]})]})},e._id)}))}),n&&n.length>0&&(0,r.jsx)(r.Fragment,{children:n.map((function(e,t){return(0,r.jsx)("div",{className:"col-lg-3 col-md-4 mt-4",children:(0,r.jsxs)("div",{className:"for_blog feat_property",children:[(0,r.jsx)("div",{className:"thumb",children:(0,r.jsx)("img",{className:"img-whp",src:"".concat(g.t4,"/").concat(e.filePath),alt:"img"})}),(0,r.jsxs)("div",{className:"details",children:[(0,r.jsx)("div",{className:"tc_content",children:(0,r.jsxs)("h5",{className:"text-center",children:["File Name : ",e.fileCaption]})}),(0,r.jsxs)("div",{className:"fp_footer",children:[(0,r.jsx)("ul",{className:"fp_meta float-start mb0",children:(0,r.jsx)("li",{className:"list-inline-item",children:e.fileSize})}),(0,r.jsxs)("ul",{className:"fp_meta float-end mb0",children:[(0,r.jsx)("li",{className:"list-inline-item",children:(0,r.jsx)("button",{onClick:function(){return l(e)},className:"btn btn-inverse-info py-1 px-2",children:c})}),(0,r.jsx)("li",{className:"list-inline-item m-0",children:(0,r.jsx)("button",{onClick:function(){return o(e._id,e.fileCaption)},className:"btn btn-inverse-danger py-1 px-2 ",children:i})})]})]})]})]})},e._id)}))}),a&&a.length>0&&(0,r.jsx)(r.Fragment,{children:a.map((function(e,t){return(0,r.jsx)("div",{className:"col-lg-3 col-md-3 mt-4",children:(0,r.jsxs)("div",{className:"for_blog feat_property",children:[(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("div",{className:!0,style:{fontSize:80},children:(0,r.jsx)("i",{className:"flaticon-document"})})}),(0,r.jsxs)("div",{className:"details",children:[(0,r.jsxs)("div",{className:"tc_content",children:[(0,r.jsxs)("h5",{className:"text-center",children:["File Name : ",e.fileCaption]}),(0,r.jsx)(m(),{href:"".concat(g.t4,"/").concat(e.filePath),children:(0,r.jsxs)("a",{target:"_blank",children:[g.t4,"/",e.filePath]})})]}),(0,r.jsxs)("div",{className:"fp_footer",children:[(0,r.jsx)("ul",{className:"fp_meta float-start mb0",children:(0,r.jsx)("li",{className:"list-inline-item pt-2",children:e.fileSize})}),(0,r.jsxs)("ul",{className:"fp_meta float-end mb0",children:[(0,r.jsx)("li",{className:"list-inline-item",children:(0,r.jsx)("button",{onClick:function(){return l(e)},className:"btn btn-inverse-info py-1 px-2",children:c})}),(0,r.jsx)("li",{className:"list-inline-item m-0",children:(0,r.jsx)("button",{onClick:function(){return o(e._id,e.fileCaption)},className:"btn btn-inverse-danger py-1 px-2 ",children:i})})]})]})]})]})},e._id)}))}),s&&s.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h4",{className:"text-success",children:"Link List"}),s.map((function(e,t){return(0,r.jsx)("div",{children:(0,r.jsx)("table",{className:"table",children:(0,r.jsx)("tbody",{className:"tbody",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"td",style:{width:"20%"},children:(0,r.jsx)("div",{className:"card border-0 p-0"})}),(0,r.jsx)("td",{className:"td",style:{width:"20%"},children:e.fileCaption}),(0,r.jsx)("td",{className:"td",style:{width:"20%"},children:e.fileLink}),(0,r.jsx)("td",{className:"td",style:{width:"20%"},children:e.fileSize}),(0,r.jsx)("td",{className:"td",style:{width:"20%"},children:(0,r.jsxs)("div",{className:"text-left",children:[(0,r.jsx)("span",{onClick:function(){return l(e)},className:"",children:c}),(0,r.jsx)("span",{onClick:function(){return o(e._id,e.fileCaption)},className:"",children:i})]})})]})})})},e._id)}))]})]})};var Ne=function(e){var t=e.handleClose,n=(e.onSubmit,e.menuname,e.masterID),s=e.dataID,l=e.fileModelRef,o=e.contID,i=e.dataTitle,c=e.fileGroup,d=e.hasImages,u=e.hasCroppedImages,m=e.hasFiles,f=e.hasLinks,p=e.cropWidth,b=e.cropHeight,j=(N.G,ne.Vui,N.G,ne.Yai,
1(0,a.useState)([])),g=j[0],v=j[1],y=(0,a.useState)([]),S=y[0],C=y[1],w=(0,a.useState)([]),Z=w[0],D=w[1],I=(0,a.useState)([]),k=I[0],M=I[1],A=(0,a.useState)(!1),T=A[0],B=A[1],E=(0,a.useState)(!1),_=E[0],O=E[1],q=(0,a.useState)(!1),R=q[0],H=q[1],P=(0,a.useState)(!1),G=P[0],L=P[1],U=(0,a.useState)(""),V=U[0],W=U[1],z=(0,a.useState)(""),Q=z[0],Y=z[1],J=(0,a.useState)(""),X=J[0],$=J[1],K=(0,a.useState)(!1),ee=K[0],te=K[1],re=function(){var e=(0,h.Z)(x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"img"!=c){e.next=8;break}return e.next=4,se(s,"singleimage").then((function(e){e.error?console.log(e.error):v(e)}));case 4:return e.next=6,se(s,"croppedimage").then((function(e){e.error?console.log(e.error):C(e)}));case 6:e.next=13;break;case 8:if("pdf"!=c){e.next=13;break}return e.next=11,se(s,"pdf").then((function(e){e.error?console.log(e.error):D(e)}));case 11:return e.next=13,ce(s).then((function(e){e.error?console.log(e.error):M(e)}));case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),console.log(e.t0);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=(0,h.Z)(x().mark((function e(t){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,le(t);case 3:F.Am.success("File is deleted"),e.next=10;break;case 6:e.prev=6,e.t0=e.catch(0),F.Am.error("Delete File Failed"),console.log(e.t0);case 10:B(!0);case 11:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}();(0,a.useEffect)((function(){re()}),[T]);var oe=function(){O(!0),L(!0),B(!1)};return(0,r.jsxs)("div",{className:"row",children:[(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsxs)("div",{className:"float-end",children:["img"===c&&(0,r.jsxs)(r.Fragment,{children:[d&&(0,r.jsxs)("button",{className:"btn btn-sm btn-outline-success btn-icon-text float-right me-2",type:"",onClick:oe,children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle btn-icon-prepend"})," Add Images"]}),(0,r.jsxs)("button",{onClick:t,className:"btn btn-sm btn-outline-danger btn-icon-text float-right me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-backspace btn-icon-prepend"})," Back"]}),u&&(0,r.jsxs)("button",{className:"btn btn-sm btn-inverse-success btn-fw float-right me-2",type:"",onClick:function(){te(!0),L(!0),B(!1)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle btn-icon-prepend"})," Add Images"]})]}),"pdf"===c&&(0,r.jsxs)(r.Fragment,{children:[m&&(0,r.jsxs)("button",{className:"btn btn-sm btn-outline-success btn-icon-text float-right me-2",type:"",onClick:oe,children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add Files"]}),f&&(0,r.jsxs)("button",{className:"btn btn-sm btn-outline-info btn-icon-text float-right me-2",type:"",onClick:function(){H(!0),L(!0),B(!1)},children:[(0,r.jsx)("i",{className:"mdi mdi-link-variant"})," Add Links"]}),(0,r.jsxs)("button",{className:"btn btn-sm btn-outline-danger btn-icon-text float-right",onClick:t,children:[(0,r.jsx)("i",{className:"mdi mdi-backspace btn-icon-prepend"})," Back"]})]})]})}),(0,r.jsx)("div",{className:"dashboard-img",children:(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsx)("div",{className:"row",children:(0,r.jsx)(ve,{imgFiles:g,cropFiles:S,pdfFiles:Z,linkFiles:k,handleEdit:function(e){B(!1),L(!1),W(e._id),Y(e.fileCaption),$(e),"croppedimage"===e.fileGroup?te(!0):O(!0),console.log("handle Edit",e)},deleteConfirm:function(e){window.confirm("Are you sure you want to delete the file?")&&(B(!1),ae(e))}})})})}),(0,r.jsx)("div",{className:"py-3 my-4 text-center",children:(0,r.jsxs)("button",{onClick:t,className:"btn btn-sm btn-outline-danger btn-icon-text",children:[(0,r.jsx)("i",{className:"mdi mdi-backspace btn-icon-prepend"})," Back"]})}),(0,r.jsx)("div",{children:_?(0,r.jsx)(me,{getdataFile:function(){return re()},fileMasterID:n,fileDataID:s,fileContID:o,fileModelRef:l,onSubmit:function(){B(!0),O(!1),re()},imageModal:_,isAddMode:G,handleClose:function(){O(!1),B(!0),re()},dataTitle:i,editImageID:V,editCaption:Q,editFile:X,fileGroup:c}):null}),(0,r.jsx)("div",{children:ee?(0,r.jsx)(je,{getdataFile:function(){return re()},fileMasterID:n,fileDataID:s,fileModelRef:l,fileContID:o,onSubmit:function(){B(!0),te(!1)},croppedImageModal:ee,isAddMode:G,handleClose:function(){te(!1),B(!0)},dataTitle:i,editImageID:V,editCaption:Q,editFile:X,fileGroup:c,cropWidth:p,cropHeight:b}):null}),(0,r.jsx)("div",{children:R?(0,r.jsx)(ge,{getdataFile:function(){return re()},fileMasterID:n,fileDataID:s,fileModelRef:l,fileContID:o,onSubmit:function(){B(!0),H(!1),re()}
1,linkModal:R,isAddMode:G,handleClose:function(){H(!1),B(!0),re()},datatitle:i,editFileID:V,editCaption:Q,editFile:X}):null})]})},ye=n(90332),Se=W()((function(){return Promise.all([n.e(9326),n.e(2911)]).then(n.t.bind(n,72911,23))}),{loadableGenerated:{webpack:function(){return[72911]}},ssr:!1});var Ce=function(e){var t=e.placeholder,n=e.formdata,l=e.menuname,o=e.entryformname,d=e.masterID,u=(e.onSubmit,e.watchFields,e.validate,e.form_title,e.entryFormTitle),m=e.hasImages,f=e.hasCroppedImages,h=e.hasLinks,p=e.hasFiles,x=e.cropWidth,b=e.cropHeight,j=(0,Z.cI)(),g=j.register,v=j.handleSubmit,y=j.reset,S=(j.watch,j.setError,j.setValue),C=j.control,D=(j.clearErrors,j.formState.errors),I=(n.formName,n.formTag,n.fields),k=(N.G,ne.Yai,(0,s.v9)((function(e){return e.selmenu.selitem}))),M=(0,a.useState)({description:""}),A=M[0],T=M[1],B=(0,a.useState)(!1),E=B[0],_=B[1],O=(0,a.useState)({}),q=O[0],R=O[1],H=(0,a.useState)({}),P=H[0],G=H[1],L=(0,a.useState)(""),U=L[0],V=L[1],W=(0,s.I0)(),Y=(0,a.useState)(!1),X=Y[0],$=Y[1],K=(0,a.useState)("img"),ee=K[0],re=K[1],ae=(0,a.useRef)(null),se=(0,a.useMemo)((function(){}),[t]),le=function(e){Q(e).then((function(e){var t;e.error?console.log(e.error):(e.length>1?e.map((function(n){t=n.order&&1===n.order?n:e[0]})):t=e[0],t&&(R(t),G(t._id)),console.log("id..",P))}))};return(0,a.useEffect)((function(){y(),T(""),_(!1),$(!1),R({}),G(""),le(d)}),[k]),(0,a.useEffect)((function(){P.length&&_(!0);var e=q.description;["title","shortDesc","designation","position","qualification","description","remarks","order","message","excerpt","location","date"].forEach((function(e){return S(e,q[e])})),T((0,c.Z)((0,i.Z)({},A),{description:e}))}),[q]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:X?(0,r.jsxs)(r.Fragment,{children:[u," - ","Images"]}):(0,r.jsx)(r.Fragment,{children:u?(0,r.jsx)(r.Fragment,{children:u}):(0,r.jsx)(r.Fragment,{children:l})})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:l})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-md-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[E&&!X&&(0,r.jsxs)(r.Fragment,{children:[(m||f)&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-end",onClick:function(){return function(e,t){G(e),V(t),$(!0),re("img"),console.log("handle Images",t)}(P,title)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," ",l," Images"]})}),(p||h)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){G(e),V(t),$(!0),re("pdf"),console.log("handle Files",U)}(P,title)},className:"btn btn-sm btn-success btn-fw float-end",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Add Attachments"]})]}),(0,r.jsx)("h4",{className:"card-title my-5"}),X?(0,r.jsx)(Ne,{handleClose:function(){$(!1)},imageComp:X,onSubmit:function(){SetSubmitted(!0)},menuname:l,masterID:d,dataID:P,fileModelRef:"SiteData",dataTitle:U,hasLinks:h,hasImages:m,hasFiles:p,hasCroppedImages:f,fileGroup:ee,cropWidth:x,cropHeight:b}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{children:(0,r.jsxs)("form",{onSubmit:v((function(e){e.description=A.description,!E&&(e.menuName=l,e.masterID=d,e.dataForm=o,e.dataSlug=(0,ye.Z)(e.title),e.description=A.description,z(e||[]).then((function(e){F.Am.success("Data Added"),le()}))),E&&(e.description=A.description,e.dataSlug=(0,ye.Z)(e.title),console.log("sending to actions",e),J(e,P).then((function(e){console.log("AEF form saved response",e),F.Am.success("Data Updated")})))})),className:"forms-sample",children:[I&&function(e){return e.map((function(e){var t=e.fieldName,n=e.label,a=e.fieldType,s=e.fieldRequired;switch(a){case"text":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control form-control-lg",type:"text",name:t,id:t},g(t,{required:s}))),D[t]&&(0,r.jsx)("span",{children:"This field is required"})]},t);case"Number":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",name:t,id:t},g(t,{required:s}))),D[t]&&(0,r.jsx)("span",{children:"This field is required"})]},t);case"email":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"email",name:t,id:t},g(t)))]},t);case"checkbox":return(0,r.jsx)("div",{className:"form-group",children:(0,r.jsxs)("label",{className:"formlabel",children:[(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",name:t,id:t},g(t))),(0,r.jsx)("span",{children:n})]})},t);case"url":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"url",name:t,id:t},g(t)))]},t);case"Date":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)(Z.Qr,{control:C,name:t,render:function(e){var t=e.field;return(0,r.jsx)(te(),{dateFormat:"dd-MM-yyyy",placeholderText:"Select date",onCh
1ange:function(e){return t.onChange(e)},selected:t.value})}}),D.dateInput&&(0,r.jsx)("span",{children:"This field is required"})]},t);case"quill":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)(Se,{ref:ae,value:A.description,config:se,tabIndex:1,onChange:function(e){return t=e,void T((0,c.Z)((0,i.Z)({},A),{description:t}));var t},name:"description",id:"description"})]},t);default:return(0,r.jsx)("div",{className:"form-group",children:(0,r.jsx)("span",{className:"red-text",children:"Invalid Field"})},t)}}))}(I),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary me-3",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){W(w.T.replaceSelMenu({item:{menuName:"Home",hasSubMenu:!1,formCategory:{value:"DashBoard",label:"Dashboard"}}||{}}))},children:"Close"})]})})})]})})})})]})},we=n(23910),Ze=function(e){return function(){var t=(0,h.Z)(x().mark((function t(n){var r,a;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=function(){var e=(0,h.Z)(x().mark((function e(t){var n,r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j()("".concat(g.bl,"/getEntryFormByName/").concat(t),{method:"GET"});case 2:if((n=e.sent).ok){e.next=5;break}throw new Error("Could not fetch menu data!");case 5:return e.next=7,n.json();case 7:return r=e.sent,e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.prev=1,t.next=4,r(e);case 4:a=t.sent,n(we.j.replaceEntryForm({formdata:a||[]})),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),n(R.A.showNotification({status:"error",title:"Error!",message:"Fetching menu data failed!"}));case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e){return t.apply(this,arguments)}}()};var De=function(e){var t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=t.dataFieldForm,o=t.entryFormTitle,i=t.masterID,c=t.hasImages,d=t.hasCroppedImages,u=t.hasLinks,m=t.hasFiles,f=t.cropWidth,h=t.cropHeight,p=(0,s.v9)((function(e){return e.entryform.formdata})),x=(0,s.I0)();return(0,a.useEffect)((function(){window.scrollTo(0,0);var e=l.label;x(Ze(e))}),[t]),(0,r.jsx)(Ce,{onSubmit:function(e){console.log(e)},form_title:o,formdata:p,menuname:n,masterID:i,entryformname:l.label,entryFormTitle:o,hasImages:c,hasCroppedImages:d,hasLinks:u,hasFiles:m,cropHeight:h,cropWidth:f,placeholder:"Description"})};var Ie=function(){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(De,{})})},Fe=n(90044),ke=n(8660),Me=n.n(ke),Ae=(n(86060),W()((function(){return Promise.all([n.e(9326),n.e(2911)]).then(n.t.bind(n,72911,23))}),{loadableGenerated:{webpack:function(){return[72911]}},ssr:!1}));var Te=function(e){var t=e.placeholder,n=e.openModal,s=e.handleClose,l=e.isAddMode,o=e.formdata,d=e.menuname,u=e.entryformname,m=e.masterID,f=e.onSubmit,h=(e.watchFields,e.validate,e.form_title),p=e.rowId,x=e.menuDataType,b=e.menuDataCategory,j=(0,Z.cI)(),g=j.register,v=j.handleSubmit,N=j.reset,y=(j.watch,j.setError,j.setValue),S=j.control,C=(j.clearErrors,j.formState.errors),w=(o.formName,o.formTag,o.fields),I=(0,a.useState)({}),k=I[0],M=I[1],A=(0,a.useState)([]),T=A[0],B=A[1],E=(0,a.useRef)(null),_=(0,a.useMemo)((function(){}),[t]);console.log("formdata in formdata",w),(0,a.useEffect)((function(){console.log("data item check",p),l||p&&Y(p).then((function(e){console.log("data after set",e),e.date=(0,ue.default)(e.date),e.dateFrom=(0,ue.default)(e.dateFrom),e.dateTo=(0,ue.default)(e.dateTo),M(e),console.log("editdata after set",k)}))}),[]),(0,a.useEffect)((function(){Q(m).then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{itemTitle:e.title}}));B(t),console.log("site data received data add form useeffect:",e)}}))}),[]),(0,a.useEffect)((function(){var e=k.description;["title","name","shortDesc","description","remarks","order","message","excerpt","location","date","dateFrom","dateTo","url","position","designation","dataSlug","qualification"].forEach((function(e){return y(e,k[e])})),R((0,c.Z)((0,i.Z)({},q),{description:e}))}),[k]);var O=(0,a.useState)({description:""}),q=O[0],R=O[1],H=function(e){var t=p;e.menuDataCategory=b,e.menuDataType=x,l&&(e.menuName=d,e.masterID=m,e.dataForm=u,e.dataSlug=(0,ye.Z)(e.title),e.description=q.description,console.log("sending to site data actions",e),z(e||[]).then((function(e){F.Am.success("Data Added"),N(),R((0,c.Z)((0,i.Z)({},q),{description:""}))}))),!l&&(console.log("data for edit",e),e.menuName=d,e.masterID=m,e.dataForm=u,e.dataSlug=(0,ye.Z)(e.title),e.description=q.description,J(e,t).then((function(e){N(),R((0,c.Z)((0,i.Z)({},q),{description:""})),F.Am.success("Data Updated")}))),f()};return console.log("editdata after set out",k),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"",show:n,size:"xl",dialogClassName:"modal-90w",onHide:s,backdrop:"static",children:[(0,r.jsxs)(D.Z.Header,{children:[(0,r.jsx)(D.Z.Title,{className:"text-center w-100",children:l?h?(0,r.jsxs)("h4",{children:["Add ",h," items"]}):(0,r.jsxs)("h4",{children:["Add ",d," "]}):(0,r.jsx)("h4",{children:h})}),(0,r.jsx)("button",{type:"button",className:"btn btn-gradient-danger btn-sm",onClick:s,children:(0,r.jsx)("i",{className:"mdi mdi-close"})})]}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:v((function(e){var t={itemTitle:e.title},n=T.findIndex((function(t){return t.itemTitle==e.title}));console.log("index of new site data item title created:",n),-1===n?(T.push(t),alert("New Site Data Item will be created"),H(e)):alert("Item title exists... Unique title required")})),className:"px-5",children:[(0,r.jsx)("div",{className:"row",children:w&&function(e){return e.map((function(e){var t=e.fieldName,n=e.label,a=e.fieldType,s=e.fieldRequired;switch(a){case"text":return(0,r.jsx)("div",{className:"title"==t?"col-md-12":"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control form-control-lg",type:"text",name:t,id:t},g(t,{required:s}
1))),C[t]&&(0,r.jsx)("span",{children:"This field is required"})]},t)});case"Number":return(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",name:t,id:t},g(t,{required:s}))),C[t]&&(0,r.jsx)("span",{children:"This field is required"})]},t);case"email":return(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"email",name:t,id:t},g(t)))]},t);case"checkbox":return(0,r.jsx)("div",{className:"form-group",children:(0,r.jsxs)("label",{className:"formlabel",children:[(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",name:t,id:t},g(t))),(0,r.jsx)("span",{children:n})]})},t);case"url":return(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"url",name:t,id:t},g(t)))]},t)});case"Date":return(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)(Z.Qr,{control:S,name:t,render:function(e){var t=e.field;return(0,r.jsx)(Me(),{timeFormat:"- hh:mm a",dateFormat:"DD/MMM/YYYY",onChange:function(e){return t.onChange(e)},value:t.value,closeOnSelect:!0,inputProps:{readOnly:!0}})}}),C.fieldName&&(0,r.jsx)("span",{children:"This field is required"})]},t)});case"quill":return(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:t,children:n}),(0,r.jsx)(Ae,{ref:E,value:q.description,config:_,tabIndex:1,onChange:function(e){return t=e,void R((0,c.Z)((0,i.Z)({},q),{description:t}));var t},name:"description",id:"description"})]},t);default:return(0,r.jsx)("div",{children:(0,r.jsx)("span",{className:"red-text",children:"Invalid Field"})},name)}}))}(w)}),(0,r.jsx)("br",{}),(0,r.jsx)("div",{className:"text-center",children:(0,r.jsxs)("button",{type:"submit",className:"btn btn-gradient-primary btn-icon-text",children:[(0,r.jsx)("i",{className:"mdi mdi-file-check btn-icon-prepend"}),"Submit"]})})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})},Be=function(e){var t=e.filterText,n=e.onFilter;e.onClear;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"input-group w-25 mt-2",children:(0,r.jsx)("input",{id:"search",placeholder:"Search","aria-label":"Recipient's username","aria-describedby":"basic-addon2",type:"text",className:"form-control form-control",autoComplete:"off",value:t,onChange:n})})})},Ee=n(30381),_e=n.n(Ee);var Oe=function(){var e=function(){w(!1),H(!0),z(d),console.log("onsubmit load data done")},t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=t.dataFieldForm,o=t.entryFormTitle,d=t.masterID,u=t.menuDataType,m=t.menuDataCategory,f=t.hasImages,h=t.hasCroppedImages,p=t.hasLinks,x=t.hasFiles,b=t.cropWidth,j=t.cropHeight,g=(0,s.v9)((function(e){return e.entryform.formdata})),v=(0,a.useState)([]),N=v[0],y=v[1],S=(0,a.useState)(!1),C=S[0],w=S[1],Z=(0,a.useState)(!1),D=Z[0],I=Z[1],F=(0,a.useState)(!0),k=F[0],M=F[1],A=(0,a.useState)(""),T=A[0],B=A[1],E=(0,a.useState)(""),_=E[0],O=E[1],q=(0,a.useState)(!1),R=q[0],H=q[1],P=(0,a.useState)("img"),G=P[0],L=P[1],U=(0,s.I0)(),V=(0,r.jsx)("i",{className:"mdi mdi-delete-forever"}),W=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"}),z=function(e){Q(e).then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));y(t),console.log("site data received load data test 1:",e)}}))};(0,a.useEffect)((function(){window.scrollTo(0,0),I(!1),z(d)}),[t,R]),(0,a.useEffect)((function(){var e=l.label;U(Ze(e))}),[t]);var Y=[{name:"#",selector:"slno",width:"5%",sortable:!0,style:{textAlign:"center"}},{name:"Title",width:"30%",sortable:!0,selector:function(e){return e.title}},{name:"Date",width:"15%",sortable:!0,selector:function(e){return e.date&&0!==Object.keys(e.date).length?_e()(e.date).format("YYYY/MMM/DD"):""}},{name:"Order",width:"10%",sortable:!0,selector:function(e){return e.order}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return t=e._id,H(!1),console.log("handle Edit",t),M(!1),w(!0),void B(t);var t},className:"btn btn-inverse-info py-1 px-2 me-2",children:W}),(0,r.jsx)("button",{onClick:function(){return t=e._id,H(!1),void X(t).then((function(e){H(!0)}));var t},className:"btn btn-inverse-danger py-1 px-2 me-5",children:V}),(f||h)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){B(e),O(t),I(!0),L("img")}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Images"]}),(x||p)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){B(e),O(t),I(!0),L("pdf")}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Files"]})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"}],J=(0,fe.Z)(a.useState(""),2),$=J[0],K=J[1],ee=(0,fe.Z)(a.useState(!1),2),te=ee[0],ne=ee[1],re=N.filter((function(e){return-1!==JSON.stringify(e).toLowerCase().indexOf($.toLowerCase())})),ae=a.useMemo((function(){return(0,r.jsx)(Be,{onFilter:function(e){return K(e.target.value)},onClear:function(){$&&(ne(!te),K(""))},filterText:$})}),[$,te]);return(0,r.jsx)(r.Fragment,{children:D?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("h3",{className:"page-title",children:[n," / ",_]}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsxs)("li",{className:"breadcrumb-item active","aria-current":"page",children:[n," / ",_]})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("h4",{className:"card-title",children:[n," / ",_," - Images List"]}),(0,r.jsx)("div",{className:"",children:(0,r.jsx)(Ne,{handleClose:function(){I(!1)},imageComp:D,onSubmit:e,menuname:n,masterID:d,dataID:T,fileModelRef:"SiteData",dataTitle:_,hasLinks:p,hasImages:f,hasFiles:x,hasCroppedImages:h,fileGroup:G,cropWidth:b,cropHeight:j})})]})})})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-end",onClick:function(e){H(!1),M(!0),w(!0)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add New ",n]}),(0,r.jsxs)("h4",{className:"card-title",children:["Manage"," ",o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})]}),(0,r.jsx)("div",{className:"table-responsive",children:(0,r.jsx)(Fe.ZP,{columns:Y,data:re,pagination:!0,paginationResetDefaultPage:te,subHeader:!0,subHeaderComponent:ae,persistTableHead:!0})})]})})})}),C?(0,r.jsx)(Te,{handleClose:function(){w(!1)}
1,openModal:C,isAddMode:k,form_title:o,formdata:g,menuname:n,menuDataType:u,menuDataCategory:m,masterID:d,entryformname:l.label,rowId:T,onSubmit:e,placeholder:"Description"}):null,";"]})})};var qe=function(){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{children:(0,r.jsx)(Oe,{})})})},Re=n(69422),He=n(65893),Pe=n.n(He),Ge=n(77632),Le=function(){return j()("".concat(g.bl,"/getEntryFormNames"),{method:"GET"}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))};var Ue=function(e){var t=e.openRootModal,n=e.handleRootClose,l=(e.isAddRoot,e.isSubmenu,(0,a.useState)({})),o=l[0],d=(l[1],(0,s.I0)()),u=(0,a.useState)([]),m=u[0],f=u[1],h=(0,a.useState)({}),p=h[0],x=h[1],b=(0,Z.cI)({defaultValues:{menuName:"",hasSubMenu:!1,isDeptBody:!1,isSubMenuGroup:!1,subMenuGroup:"NoSubmenuGroup",formCategory:"",dataFieldForm:"",entryFormTitle:"",order:1}}),j=(b.setError,b.watch),g=b.register,v=b.handleSubmit,N=b.control,y=(b.reset,b.setValue),S=(b.formState,b.formState.errors);(0,a.useEffect)((function(){Le().then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.formName,value:e._id}}));f(t)}console.log("entryformfromuseeffect",e)}))}),[]);var C=[{value:"SingleItem",label:"Single Item"},{value:"MultipleItems",label:"Multiple Items"},{value:"DashBoard",label:"Dash Board"},{value:"MultipleCustomData",label:"Multiple Custom Data"},{value:"MultipleCustomMasters",label:"Multiple Custom Masters"},{value:"CustomForms",label:"Custom Forms"}],w=[{value:"DefaultCustomForm",label:"DefaultCustomForm"},{value:"DeptBodyForm",label:"Dept Body Form"},{value:"ContactForm",label:"Contact Form"}],F=j("hasSubMenu"),k=j("isSubMenuGroup"),M=j("hasImages"),A=j("hasCroppedImages"),T=(j("formCategory"),j("isDeptBody"));return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{show:t,onHide:n,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:"Add New Menu"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:v((function(e){console.log("Submission Verified,",e),e.parent=null,e.menuSlug=(0,ye.Z)(e.menuName),!F&&(e.isDeptBody=!1),(T||F)&&(e.deptBody="",e.formCategory={},e.dataFieldForm="",e.customForm=""),d(G(e||[])),n()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Item"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Menu Item",type:"text",placeholder:"Menu Name"},g("menuName",{required:!0,maxLength:80}))),S.menuName&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Submenu"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.hasSubMenu,placeholder:"Has Submenu",onBlur:function(e){return y(e.target.value)}},g("hasSubMenu",{}))),F&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"Is Submenu Group"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.isSubMenuGroup,placeholder:"isSubMenuGroup"},g("isSubMenuGroup",{}))),(0,r.jsx)("label",{className:"formlabel mt-0",children:"Is DeptBody"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.isDeptBody,placeholder:"Is a Dept./Body?",onBlur:function(e){return y(e.target.value)}},g("isDeptBody",{})))]}),k&&F&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Submenu Group"}),(0,r.jsxs)("select",(0,c.Z)((0,i.Z)({className:"selectpicker"},g("subMenuGroup")),{children:[(0,r.jsx)("option",{value:"NoSubmenuGroup",children:"No Submenu Group"}),(0,r.jsx)("option",{value:"Department",children:"Department"}),(0,r.jsx)("option",{value:"Clubs",children:"Clubs and Cells"}),(0,r.jsx)("option",{value:"Activities",children:"Activities"}),(0,r.jsx)("option",{value:"Collaboration",children:"Collaboration"})]}))]})]}),!F&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Form Category"}),(0,r.jsx)(Z.Qr,{name:"formCategory",control:N,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:C,onChange:function(e){t.onChange(e),function(e){console.log("changed data",e),x(e)}(e)},placeholder:"Select a form category",className:"formcontrol"}))}})]}),"CustomForms"===p.value&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Custom Form"}),(0,r.jsx)(Z.Qr,{name:"customForm",control:N,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:w,placeholder:"Select a custom form",className:"formcontrol"}))}})]}),"CustomForms"!=p.value&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Data Field Form"}),(0,r.jsx)(Z.Qr,{name:"dataFieldForm",control:N,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:m,placeholder:"Select a data field form",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Entry Form Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Form Title",type:"text",placeholder:"Form Title"},g("entryFormTitle",{required:!1,maxLength:80})))]}),(0,r.jsx)("div",{children:(0,r.jsx)("h3",{children:"Data File Attachments"})}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-3 align-items-center",children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Images"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.hasImages,placeholder:"Has Images",onBlur:function(e){return y(e.target.value)}},g("hasImages",{})))]}),M&&(0,r.jsxs)("div",{className:"col-8 d-inline-flex align-items-center",children:[(0,r.jsx)("label",{className:"formlabel col-4",children:"Max Image Size(MB)"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control col-6",type:"Number",placeholder:"Image Size"},g("maxSize",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Cropped Images"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.hasCroppedImages,placeholder:"Has CroppedImages",onBlur:function(e){return y(e.target.value)}},g("hasCroppedImages",{}))),A&&(0,r.jsxs)("div",{className:"col-12 d-inline-flex align-items-center",children:[(0,r.jsx)("label",{className:"formlabel col-2 ml-0",children:"Crop Width"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"Image Size"},g("cropWidth",{}))),(0,r.jsx)("label",{className:"formlabel col-2",children:"Crop Height"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"Image Size"},g("cropHeight",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Links"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.hasLinks,placeholder:"Has Links",onBlur:function(e){return y(e.target.value)}},g("hasLinks",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Files"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.hasFiles,placeholder:"Has Files",onBlur:function(e){return y(e.target.value)}},g("hasFiles",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},g("order",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Parent Menu (Non Editable)"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",readOnly:!0,t
1ype:"text",placeholder:"parent"},g("parent",{})))]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary",children:"Save"}),(0,r.jsx)(I.Z,{variant:"danger",type:"submit",className:"ml-5",onClick:function(){return n()},children:"Close"})]})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})},Ve=n(84195);var We=function(e){var t=e.openModal,n=e.handleClose,l=e.isAddMode,o=e.menuitem,d=(0,a.useState)({}),u=d[0],m=(d[1],(0,s.I0)()),f=(0,a.useState)([]),p=f[0],b=f[1],v=(0,a.useState)({}),N=v[0],y=v[1],S=(0,a.useState)([]),C=(S[0],S[1],(0,a.useState)([])),w=C[0],F=C[1],k=(0,a.useState)([]),M=k[0],A=k[1],T=(0,a.useState)([]),B=T[0],E=(T[1],e.menuitem._id),_=(0,Z.cI)({defaultValues:{menuName:"",menuDisplayName:"",hasSubMenu:!1,isDeptBody:!1,isAddOfficialMenu:!1,DeptBody:"",isSubMenuGroup:!1,subMenuGroup:"NoSubmenuGroup",formCategory:{},dataFieldForm:"",customForm:"",entryFormTitle:"",hasImages:!1,hasCroppedImages:!1,hasLinks:!1,hasFiles:!1,maxSize:10,cropWidth:16,cropHeight:9,order:1,parent:o.menuName}}),O=(_.setError,_.watch),q=_.register,H=_.handleSubmit,L=_.control,U=(_.reset,_.setValue),V=(_.formState,_.formState.errors);(0,a.useEffect)((function(){if(!l){["menuName","menuDisplayName","isSubMenuGroup","subMenuGroup","parent","formCategory","dataFieldForm","customForm","hasSubMenu","order","entryFormTitle","hasImages","hasCroppedImages","hasLinks","hasFiles","maxSize","cropWidth","cropHeight","isAddOfficialMenu","DeptBody","isDeptBody"].forEach((function(e){return U(e,o[e])})),o.parent&&(e=E,j()("".concat(g.bl,"/newmenus/").concat(e),{method:"GET"}).then((function(e){return e.json()})).catch((function(e){return console.log(e)}))).then((function(e){var t=e.parentname;U("parent",t)}))}var e;(0,Ve.BB)("deptbody").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{bodyname:e.name}}));F(t)}}))}),[]),(0,a.useEffect)((function(){Le().then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.formName,value:e._id}}));b(t)}}))}),[]),(0,a.useEffect)((function(){(0,Ve.BB)("menuDataType").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));A(t),console.log("menudatatype full data",e),console.log("menu data type Options data",t)}}))}),[]),(0,a.useEffect)((function(){(0,Ve.BB)("menuDataCategory").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));A(t),console.log("menudatacategory full data",e),console.log("menu data category Options data",t)}}))}),[]);var W=function(e){console.log("changed data",e),y(e)},z=[{value:"SingleItem",label:"Single Item"},{value:"MultipleItems",label:"Multiple Items"},{value:"DashBoard",label:"Dash Board"},{value:"MultipleCustomData",label:"Multiple Custom Data"},{value:"EventMultiDataComp",label:"Multiple Event Data"},{value:"MultipleCustomMasters",label:"Multiple Custom Masters"},{value:"CustomForms",label:"Custom Forms"}],Q=O("hasSubMenu"),Y=O("isSubMenuGroup"),J=O("hasImages"),X=O("hasCroppedImages"),$=(O("formCategory"),O("isAddOfficialMenu")),K=O("isDeptBody"),ee=function(e){(null===e.menuDisplayName||""===e.menuDisplayName)&&(e.menuDisplayName=e.menuName),console.log("Submission Verified,",e),l&&(e.parent=E,e.menuSlug=(0,ye.Z)(e.menuName),!Q&&(e.isDeptBody=!1),(K||Q)&&(e.deptBody="",e.formCategory={value:"DashBoard",label:"Dashboard"},e.dataFieldForm="",e.customForm=""),$&&(e.formCategory.value="CustomForms",e.formCategory.label="Custom Forms",e.deptBody=o.deptBody),m(G(e||[]))),!l&&(e.parent=o.parent,e.menuSlug=(0,ye.Z)(e.menuName),!Q&&(e.isDeptBody=!1,e.deptBody=""),(K||Q)&&(e.formCategory={},e.dataFieldForm="",e.customForm=""),$&&(e.formCategory.value="CustomForms",e.formCategory.label="Custom Forms",e.deptBody=o.deptBody),!$&&(e.deptBody=""),m(function(e,t){return console.log("sending update test",e),function(){var n=(0,h.Z)(x().mark((function n(r){var a;return x().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r(R.A.showNotification({status:"pending",title:"Sending...",message:"Sending menu form data!"})),a=function(){var e=(0,h.Z)(x().mark((function e(t,n){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j()("".concat(g.bl,"/newmenus/").concat(n),{method:"PUT",headers:{Accept:"application/json","Content-type":"application/json"},body:JSON.stringify(t)});case 2:if(e.sent.ok){e.next=5;break}throw new Error("Sending menu update data failed.");case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),n.prev=2,n.next=5,a(e,t);case 5:r(R.A.showNotification({status:"success",title:"Success!",message:"Updated menu item successfully!"})),n.next=11;break;case 8:n.prev=8,n.t0=n.catch(2),r(R.A.showNotification({status:"error",title:"Error!",message:"Update menu item failed!"}));case 11:r(P());case 12:case"end":return n.stop()}}),n,null,[[2,8]])})));return function(e){return n.apply(this,arguments)}}()}(e||[],E))),n()};return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:l?"Add New Menu Item":"Edit Menu Item"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:H((function(e){if(l){var t={bodyname:e.menuName};if(K){var n=w.findIndex((function(t){return t.bodyname==e.menuName}));console.log("index of new dept body name created:",n),-1===n?(w.push(t),alert("Dept Body will be created"),ee(e)):alert("Dept Body Exists")}else ee(e)}else ee(e)}
1)),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Item"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Menu Item",type:"text",placeholder:"Menu Name"},q("menuName",{required:!0,maxLength:80}))),V.menuName&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Submenu"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.hasSubMenu,placeholder:"Has Submenu",onBlur:function(e){return U(e.target.value)}},q("hasSubMenu",{}))),Q&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"Is Submenu Group"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.isSubMenuGroup,placeholder:"isSubMenuGroup"},q("isSubMenuGroup",{}))),(0,r.jsx)("label",{className:"formlabel mt-0",children:"Is DeptBody"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.isDeptBody,placeholder:"Is a Dept./Body?",onBlur:function(e){return U(e.target.value)}},q("isDeptBody",{})))]}),Y&&Q&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Submenu Group"}),(0,r.jsxs)("select",(0,c.Z)((0,i.Z)({className:"selectpicker"},q("subMenuGroup")),{children:[(0,r.jsx)("option",{value:"NoSubmenuGroup",children:"No Submenu Group"}),(0,r.jsx)("option",{value:"Department",children:"Department"}),(0,r.jsx)("option",{value:"Clubs",children:"Clubs and Cells"}),(0,r.jsx)("option",{value:"Facilities",children:"Facilities"}),(0,r.jsx)("option",{value:"AddOnCourses",children:"Add On Courses"}),(0,r.jsx)("option",{value:"Collaboration",children:"Collaboration"})]}))]})]}),!Q&&(0,r.jsxs)(r.Fragment,{children:[(o.isDeptBody||o.isAddOfficialMenu)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Is Add Official Menu ?"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.isAddOfficialMenu,placeholder:"Is Add Official Menu ?",onBlur:function(e){return U(e.target.value)}},q("isAddOfficialMenu",{})))]}),!$&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Form Category"}),(0,r.jsx)(Z.Qr,{name:"formCategory",setValue:o.formCategory,control:L,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:z,onChange:function(e){t.onChange(e),W(e)},placeholder:"Select a form category",className:"formcontrol"}))}})]}),"CustomForms"!=N.value&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Data Field Form"}),(0,r.jsx)(Z.Qr,{name:"dataFieldForm",setValue:o.dataFieldForm,control:L,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:p,placeholder:"Select a data field form",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Entry Form Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Form Title",type:"text",placeholder:"Form Title"},q("entryFormTitle",{required:!1,maxLength:80})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Data Type"}),(0,r.jsx)(Z.Qr,{name:"menuDataType",setValue:o.menuDataType,control:L,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:M,onChange:function(e){t.onChange(e),W(e)},placeholder:"Select a Menu Data Type",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Data Category"}),(0,r.jsx)(Z.Qr,{name:"menuDataCategory",setValue:o.menuDataCategory,control:L,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:B,onChange:function(e){t.onChange(e),W(e)},placeholder:"Select a Menu Data Category",className:"formcontrol"}))}})]}),(0,r.jsx)("div",{children:(0,r.jsx)("h3",{children:"Data File Attachments"})}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-3 align-items-center",children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Images"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.hasImages,placeholder:"Has Images",onBlur:function(e){return U(e.target.value)}},q("hasImages",{})))]}),J&&(0,r.jsxs)("div",{className:"col-8 d-inline-flex align-items-center",children:[(0,r.jsx)("label",{className:"formlabel col-4",children:"Max Image Size(MB)"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control col-6",type:"Number",placeholder:"Image Size"},q("maxSize",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Cropped Images"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.hasCroppedImages,placeholder:"Has CroppedImages",onBlur:function(e){return U(e.target.value)}},q("hasCroppedImages",{}))),X&&(0,r.jsxs)("div",{className:"col-12 d-inline-flex align-items-center",children:[(0,r.jsx)("label",{className:"formlabel col-2 ml-0",children:"Crop Width"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"Image Size"},q("cropWidth",{}))),(0,r.jsx)("label",{className:"formlabel col-2",children:"Crop Height"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"Image Size"},q("cropHeight",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Links"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.hasLinks,placeholder:"Has Links",onBlur:function(e){return U(e.target.value)}},q("hasLinks",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Files"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:u.hasFiles,placeholder:"Has Files",onBlur:function(e){return U(e.target.value)}},q("hasFiles",{})))]})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},q("order",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Parent Menu (Non Editable)"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",readOnly:!0,t
1ype:"text",placeholder:"parent"},q("parent",{})))]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary",children:"Save"}),(0,r.jsx)(I.Z,{variant:"danger",type:"submit",className:"ml-5",onClick:function(){return n()},children:"Close"})]})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};function ze(e){var t,n=function(e){Array.isArray(I)&&w((function(e){return!e}))},l=e.depthStep,o=void 0===l?10:l,u=e.depth,m=void 0===u?0:u,p=(e.expanded,e.item),b=(0,d.Z)(e,["depthStep","depth","expanded","item"]),N=(0,s.I0)(),y=(0,a.useState)(!0),S=y[0],w=y[1],Z=(p.id,p.menuName),D=p.hasSubMenu,I=(p.parent,p.children),k=(0,a.useState)(!1),M=k[0],A=k[1],T=(0,a.useState)(!0),B=T[0],E=T[1],_=(0,a.useState)(!1),O=(_[0],_[1]),q=((0,f.ej)("token"),p._id),H=function(){console.log("Sending from managemenu to delete:",q),O(!1),N(function(e){return console.log("sending update test",e),function(){var t=(0,h.Z)(x().mark((function t(n){var r;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n(R.A.showNotification({status:"pending",title:"Sending...",message:"Sending menu form data!"}),console.log("here")),r=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("rcvd in senddeleterequest for delete",t),e.next=3,j()("".concat(g.bl,"/newmenus/").concat(t),{method:"DELETE"});case 3:if((n=e.sent).ok){e.next=8;break}throw new Error("Delete menu item failed.");case 8:return e.abrupt("return",n);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.prev=2,t.next=5,r(e);case 5:console.log("reached here"),P(),n(R.A.showNotification({status:"success",title:"Deleted!",message:"Deleted menu item successfully!"})),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(2),n(R.A.showNotification({status:"error",title:"Error!",message:"Delete menu item failed!"}));case 13:n(P());case 14:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}()}(q)).then((function(e){e?console.log("No Response"):O(!0),F.Am.success("Menu Item Deleted"),console.log("Response",e)})),console.log("returned:",q)};D&&(t=S?(0,r.jsx)("i",{className:"mdi mdi-arrow-left-bold-circle",onClick:n}):(0,r.jsx)("i",{className:"mdi mdi-arrow-down-bold-circle",onClick:n})),D||(t=(0,r.jsx)("i",{className:"mdi mdi-checkbox-blank-circle"}));var G=(0,r.jsx)("button",{className:"btn btn-sm btn-success p-1",children:(0,r.jsx)("i",{className:"mdi mdi-plus-circle",onClick:function(){O(!1),E(!0),A(!0)}})}),L=(0,r.jsx)("button",{className:"btn btn-inverse-info p-1",children:(0,r.jsx)("i",{className:"mdi mdi-pencil-box",onClick:function(){O(!1),E(!1),A(!0)}})}),U=(0,r.jsx)("button",{className:"btn btn-inverse-danger p-1 mr-5",children:(0,r.jsx)("i",{className:"mdi mdi-delete-forever",onClick:function(){p.children.length>0?alert("This menu item has sub menus! Delete sub menus to delete parent menu"):window.confirm("Are you sure you want to delete the User?")&&(O(!1),H())}})});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z.Item,(0,c.Z)((0,i.Z)({className:Pe().managemenuitem},b),{children:(0,r.jsxs)("div",{style:{paddingLeft:m*o},className:Pe().managemenucontent,children:[t," ",(0,r.jsx)("span",{style:{marginRight:60},children:Z}),D&&G,L,U,M?(0,r.jsx)(We,{handleClose:function(){A(!1),O(!0)},openModal:M,isAddMode:B,menuitem:p}):null]})})),(0,r.jsx)(v.Z,{in:!S,unmountOnExit:!0,children:Array.isArray(I)?(0,r.jsx)(C.Z,{className:"list-group",children:I.map((function(e,t){return(0,r.jsx)(a.Fragment,{children:(0,r.jsx)(ze,{depth:m+1,depthStep:o,item:e})},"".concat(e.name).concat(t))}))}):null})]})}var Qe=function(e){var t=e.depthStep,n=e.depth,l=e.expanded,o=(0,s.I0)(),i=(0,s.v9)((function(e){return e.menu.items})),c=(0,a.useState)(!1),d=c[0],u=c[1],m=(0,a.useState)(!1),f=m[0],h=m[1],p=(0,a.useState)(!1),x=p[0],b=(p[1],(0,a.useState)(!1));return b[0],b[1],(0,a.useEffect)((function(){document.querySelector("body").scrollTo(0,0),window.scrollTo(0,0),o(P())}),[]),(0,r.jsxs)("div",{className:"container",style:{paddingTop:30},children:[(0,r.jsx)(C.Z,{className:"list-group",children:(0,r.jsxs)(C.Z.Item,{className:Pe().managemenuitem,children:[(0,r.jsxs)("div",{className:Pe().managemenucontent,children:["Add Root Menu",(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-right",onClick:function(){h(!0),u(!0)},children:(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})})]}),(0,r.jsx)("div",{children:d?(0,r.jsx)(Ue,{handleRootClose:function(){u(!1),o(P())},openRootModal:d,isAddRoot:f,isSubmenu:x}):null})]})}),(0,r.jsx)("ul",{className:"list-group",children:i.map((function(e,s){return(0,r.jsx)(a.Fragment,{children:(0,r.jsx)(ze,{depthStep:t,depth:n,exp
1anded:l,item:e})},"".concat(e.menuName).concat(s))}))})]})};var Ye=function(e){var t=e.submenuModal,n=e.handleSubmenuRootClose,l=(e.isAddRoot,e.isSubmenu,(0,a.useState)({})),o=l[0],c=(l[1],(0,s.I0)(),(0,a.useState)([])),d=(c[0],c[1],(0,a.useState)({})),u=(d[0],d[1],(0,Z.cI)({defaultValues:{menuName:"",hasSubMenu:!0,isDeptBody:!1,isSubMenuRoot:!0,order:1}})),m=(u.setError,u.watch,u.register),f=u.handleSubmit,h=(u.control,u.reset,u.setValue),p=(u.formState,u.formState.errors);return console.log("Modal State2",t),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{show:t,onHide:n,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:"Add New Submenu Group"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:f((function(e){console.log("Submission Verified,",e),A(e||[]).then((function(e){console.log("data saved",e)})),n()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Item"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Menu Item",type:"text",placeholder:"Menu Name"},m("menuName",{required:!0,maxLength:80}))),p.menuName&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Is DeptBody"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:o.isDeptBody,placeholder:"Is a Dept./Body?",onBlur:function(e){return h(e.target.value)}},m("isDeptBody",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Order By"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",placeholder:"order"},m("order",{})))]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary",children:"Save"}),(0,r.jsx)(I.Z,{variant:"danger",type:"",className:"ml-5",onClick:function(){return n()},children:"Close"})]})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var Je=function(e){var t=e.openModal,n=e.handleClose,s=(e.handleForm,e.isAddMode),l=e.menuitem,o=(0,a.useState)({}),d=o[0],u=(o[1],(0,a.useState)([])),m=u[0],f=u[1],h=(0,a.useState)({}),p=h[0],x=h[1],b=e.menuitem._id,j=(0,Z.cI)({defaultValues:{menuName:"",hasSubMenu:!1,isDeptBody:!1,isAddOfficialMenu:!1,isSubMenuGroup:!1,subMenuGroup:"NoSubmenuGroup",formCategory:{},dataFieldForm:"",entryFormTitle:"",hasImages:!1,hasCroppedImages:!1,hasLinks:!1,hasFiles:!1,maxSize:10,cropWidth:16,cropHeight:9,order:1,parent:"",CurrParent:l.parent||""}}),g=(j.setError,j.watch),v=j.register,N=j.handleSubmit,y=j.control,S=(j.reset,j.setValue),C=(j.formState,j.formState.errors);(0,a.useEffect)((function(){if(console.log("menu detail check ",l),!s){["menuName","isGroupSubMenu","subMenuGroup","parent","formCategory","dataFieldForm","customForm","hasSubMenu","order","entryFormTitle","hasImages","hasCroppedImages","hasLinks","hasFiles","maxSize","cropWidth","cropHeight","isAddOfficialMenu","DeptBody","isDeptBody"].forEach((function(e){return S(e,l[e])})),l.parent&&E(b).then((function(e){var t=e.parentname;S("CurrParent",t)}))}}),[]),(0,a.useEffect)((function(){Le().then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.formName,value:e._id}}));f(t)}console.log("entryformfromuseeffect",e)}))}),[]);var w=[{value:"SingleItem",label:"Single Item"},{value:"MultipleItems",label:"Multiple Items"},{value:"DashBoard",label:"Dash Board"},{value:"MultipleCustomData",label:"Multiple Custom Data"},{value:"MultipleCustomMasters",label:"Multiple Custom Masters"},{value:"CustomForms",label:"Custom Forms"}],F=[{value:"DefaultCustomForm",label:"DefaultCustomForm"},{value:"DeptBodyForm",label:"Dept Body Form"},{value:"ContactForm",label:"Contact Form"}],k=g("hasSubMenu"),M=(g("isSubMenuGroup"),g("hasImages")),B=g("hasCroppedImages"),_=(g("formCategory"),g("isAddOfficialMenu"));return g("isDeptBody"),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{show:t,onHide:n,backdrop:"static",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:s?"Add New Sub Menu Group":"Edit Sub Menu Group"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:N((function(t){console.log("Submission Verified,",t),s&&(t.parent=b,!k&&(t.isDeptBody=!1),_&&(t.formCategory.value="CustomForms",t.formCategory.label="Custom Forms"),A(t).then((function(t){console.log("data saved",t),e.handleClose()}))),!s&&(t.parent=l.parent,!k&&(t.isDeptBody=!1),_&&(t.formCategory.value="CustomForms",t.formCategory.label="Custom Forms"),T(t,b).then((function(t){console.log("data saved",t),e.handleClose()}))),e.handleClose()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Menu Item"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Menu Item",type:"text",placeholder:"Menu Name"},v("menuName",{required:!0,maxLength:80}))),C.menuName&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Submenu"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.hasSubMenu,placeholder:"Has Submenu",onBlur:function(e){return S(e.target.value)}},v("hasSubMenu",{}))),k&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Is DeptBody"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.isDeptBody,placeholder:"Is a Dept./Body?",onBlur:function(e){return S(e.target.value)}},v("isDeptBody",{})))]})]}),!k&&(0,r.jsxs)(r.Fragment,{children:[(l.isDeptBody||l.isAddOfficialMenu)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Is Add Official Menu ?"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.isAddOfficialMenu,placeholder:"Is Add Official Menu ?",onBlur:function(e){return S(e.target.value)}},v("isAddOfficialMenu",{})))]}),!_&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Form Category"}),(0,r.jsx)(Z.Qr,{name:"formCategory",setValue:l.formCategory,control:y,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:w,onChange:function(e){t.onChange(e),function(e){console.log("changed data",e),x(e)}(e)},placeholder:"Select a form category",className:"formcontrol"}))}})]}),"CustomForms"===p.value&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Custom Form"}),(0,r.jsx)(Z.Qr,{name:"customForm",setValue:l.customForm,control:y,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:F,placeholder:"Select a custom form",className:"formcontrol"}))}})]}),"CustomForms"!=p.value&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Data Field Form"}),(0,r.jsx)(Z.Qr,{name:"dataFieldForm",setValue:l.dataFieldForm,control:y,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:m,placeholder:"Select a data field form",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Entry Form Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",label:"Form Title",type:"text",placeholder:"Form Title"},v("entryFormTitle",{required:!1,maxLength:80})))]}),(0,r.jsx)("div",{children:(0,r.jsx)("h3",{children:"Data File Attachments"})}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-3 align-items-center",children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Images"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.hasImages,placeholder:"Has Images",onBlur:function(e){return S(e.target.value)}},v("hasImages",{})))]}),M&&(0,r.jsxs)("div",{className:"col-8 d-inline-flex align-items-center",children:[(0,r.jsx)("label",{className:"formlabel col-4",children:"Max Image Size(MB)"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control col-6",type:"Number",placeholder:"Image Size"},v("maxSize",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Cropped Images"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.hasCroppedImages,placeholder:"Has CroppedImages",onBlur:function(e){return S(e.target.value)}},v("hasCroppedImages",{}))),B&&(0,r.jsxs)("div",{className:"col-12 d-inline-flex align-items-center",children:[(0,r.jsx)("label",{className:"formlabel col-2 ml-0",children:"Crop Width"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"Image Size"},v("cropWidth",{}))),(0,r.jsx)("label",{className:"formlabel col-2",children:"Crop Height"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"Image Size"},v("cropHeight",{})))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Links"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.hasLinks,placeholder:"Has Links",onBlur:function(e){return S(e.target.value)}},v("hasLinks",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel mt-0",children:"Has Files"}),(0,r.jsx)("input",(0,i.Z)({className:"form-chkbox",type:"checkbox",defaultChecked:d.hasFiles,placeholder:"Has Files",onBlur:function(e){return S(e.target.value)}},v("hasFiles",{})))]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},v("order",{})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Parent Menu (Non Editable)"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",readOnly:!0,t
1ype:"text",placeholder:"parent"},v("parent",{})))]}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{type:"submit",className:"btn btn-primary",children:"Save"}),(0,r.jsx)(I.Z,{variant:"danger",type:"submit",className:"ml-5",onClick:function(){return n()},children:"Close"})]})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};function Xe(e){var t,n=function(e){Array.isArray(w)&&u((function(e){return!e}))},l=((0,s.I0)(),(0,a.useState)(!0)),o=l[0],u=l[1],m=(e.refreshmode,e.handlerefresh),h=e.depthStep,p=void 0===h?10:h,x=e.depth,b=void 0===x?0:x,j=(e.expanded,e.item),g=(0,d.Z)(e,["refreshmode","handlerefresh","depthStep","depth","expanded","item"]),y=(j.id,j.menuName),S=j.hasSubMenu,w=(j.parent,j.children),Z=(0,a.useState)(!1),D=Z[0],I=Z[1],k=(0,a.useState)(!0),M=k[0],A=k[1],T=((0,f.ej)("token"),j._id),B=function(){console.log("Sending from managemenu to delete:",T),_(T).then((function(t){t.error?(F.Am.error(t.error),console.log(t.error),e.handlerefresh()):(F.Am.success("Submenu Deleted"),e.handlerefresh())}))};S&&(t=o?(0,r.jsx)(N.G,{icon:ne.dWM,size:"lg",onClick:n,className:"menuicon"}):(0,r.jsx)(N.G,{icon:ne.XSi,size:"lg",onClick:n,className:"menuicon"})),S||(t=(0,r.jsx)(N.G,{icon:ne.GiB,size:"lg",className:"menuicon"}));var E=(0,r.jsx)("button",{className:"btn btn-sm btn-success p-1",children:(0,r.jsx)("i",{className:"mdi mdi-plus-circle",onClick:function(){A(!0),I(!0)}})}),O=(0,r.jsx)("button",{className:"btn btn-inverse-info p-1",children:(0,r.jsx)("i",{className:"mdi mdi-pencil-box",onClick:function(){A(!1),I(!0)}})}),q=(0,r.jsx)("button",{className:"btn btn-inverse-danger p-1 mr-5",children:(0,r.jsx)("i",{className:"mdi mdi-delete-forever",onClick:B})});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z.Item,(0,c.Z)((0,i.Z)({className:"d-flex justify-content-between align-items-start",style:{justifyContent:"space-between"}},g),{children:(0,r.jsxs)("div",{style:{paddingLeft:b*p},className:"subMenuItemContent d-flex justify-content-between ali",children:[t,(0,r.jsx)("div",{className:"subMenuItemText",children:y}),(0,r.jsxs)("div",{className:"menuicons pull-right",children:[S&&E,O,q,D?(0,r.jsx)(Je,{handleClose:function(){I(!1),m()},openModal:D,isAddMode:M,menuitem:j}):null]})]})})),(0,r.jsx)(v.Z,{in:!o,unmountOnExit:!0,children:Array.isArray(w)?(0,r.jsx)(C.Z,{className:"list-group",children:w.map((function(e,t){return(0,r.jsx)(a.Fragment,{children:(0,r.jsx)(Xe,{depth:b+1,depthStep:p,item:e,handlerefresh:m})},"".concat(e.name).concat(t))}))}):null})]})}var $e=function(e){var t=e.depthStep,n=e.depth,l=e.expanded,o=function(){S(),y("submitted")},i=((0,s.I0)(),(0,s.v9)((function(e){return e.menu.items})),(0,a.useState)(!1)),c=i[0],d=i[1],u=(0,a.useState)(!1),m=u[0],f=u[1],h=(0,a.useState)(!1),p=h[0],x=h[1],b=(0,a.useState)([]),j=b[0],g=b[1],v=(0,a.useState)("pending"),N=v[0],y=v[1],S=function(){B().then((function(e){e.error?console.log(e.error):(g(e),console.log("site data received useeffect:",e))}))};return(0,a.useEffect)((function(){document.querySelector("body").scrollTo(0,0),S()}),[N]),(0,r.jsxs)("div",{className:"container",style:{paddingTop:30},children:[(0,r.jsx)(C.Z,{className:"list-group",children:(0,r.jsxs)(C.Z.Item,{className:"d-flex justify-content-between align-items-start menuitem",style:{justifyContent:"space-between"},children:[(0,r.jsxs)("div",{className:"sidebar-item-content d-flex justify-content-between align-item-start",children:[(0,r.jsx)("div",{className:"rootSubMenuAddTextItem w-100",children:"Add Submenu Group "}),(0,r.jsx)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-right",onClick:function(){x(!0),f(!0),d(!0)},children:(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})})]}),(0,r.jsx)("div",{children:c?(0,r.jsx)(Ye,{handleSubmenuRootClose:function(){d(!1),S()},submenuModal:c,isAddRoot:m,isSubmenu:p}):null})]})}),(0,r.jsx)(C.Z,{className:"list-group",children:j.length>0&&j.map((function(e,s){return(0,r.jsx)(a.Fragment,{children:(0,r.jsx)(Xe,{depthStep:t,depth:n,expanded:l,item:e,handlerefresh:o,refreshmode:N})},"".concat(e.menuName).concat(s))}))})]})};n(40993);var Ke=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID,e.masterItem),d=e.onSubmit,u=(e.watchFields,e.validate,e.form_title),m=e.rowId,f=(0,Z.cI)(),h=f.register,p=f.handleSubmit,x=f.reset,b=(f.watch,f.setError,f.setValue),j=f.control,g=(f.clearErrors,f.formState.errors),v=(0,a.useState)({}),N=v[0],y=v[1],S=(0,a.useState)([]),C=S[0],w=(S[1],(0,a.useState)([])),I=w[0],k=w[1];return(0,a.useEffect)((function(){if(console.log("data item check",m),console.log("item check",o),!s){var e=o;m.length>0&&e.length>0&&(0,Ve.NH)(m,e).then((function(e){y(e),console.log("data after set",e),console.log("editdata after set",N)}))}}
1),[]),(0,a.useEffect)((function(){["name","shortDescr","grade","order"].forEach((function(e){return b(e,N[e])})),console.log("editdata set to formfields",N)}),[N]),console.log("Options",C),(0,a.useEffect)((function(){(0,Ve.BB)("grade").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));k(t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:s?"Add New Master Item":"Edit Master Item"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:p((function(e){e.slug=(0,ye.Z)(e.name);var t=o,n=m;s&&(0,Ve.tv)(e,t).then((function(e){x(),F.Am.success("Item Added")})),!s&&(console.log("data for edit",e),(0,Ve.kd)(n,e,t).then((function(e){console.log("DataAddItem saved response",e),x(),F.Am.success("Item Updated")}))),d()})),children:[(0,r.jsx)("div",{className:"mb-3",children:u?(0,r.jsx)("h2",{children:u}):(0,r.jsx)("h2",{children:l})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"name",children:"Name"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"name",id:"name"},h("name",{required:!0}))),g.name&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsx)("div",{children:"subject"===o&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Grade"}),(0,r.jsx)(Z.Qr,{name:"grade",setValue:N.grade,control:j,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:I,placeholder:"Select a grade",className:"formcontrol"}))}})]})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDescr",children:"Short Descr"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDescr",id:"shortDescr"},h("shortDescr",{required:!1}))),g.shortDescr&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",name:"order",id:"order"},h("order",{required:!1}))),g.order&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var et=function(){var e=(0,s.v9)((function(e){return e.selmenu.selitem})),t=e.menuName,n=(e.formCategory,e.dataFieldForm),l=e.entryFormTitle,o=e.masterID,d=(e.hasImages,e.hasCroppedImages,e.hasLinks,e.hasFiles,e.cropWidth,e.cropHeight,(0,a.useState)()),u=d[0],m=d[1],f=(0,a.useState)(!1),h=f[0],p=f[1],x=(0,a.useState)(!0),b=x[0],j=x[1],g=(0,a.useState)(""),v=g[0],N=g[1],y=(0,a.useState)(""),S=(y[0],y[1],(0,a.useState)(!1)),C=S[0],w=S[1],Z=(0,a.useState)(""),D=Z[0],I=Z[1],k=(0,r.jsx)("i",{className:"mdi mdi-delete-forever"}),M=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"});(0,a.useEffect)((function(){"User Type"===t?I("contactType"):"Designation"===t?I("designation"):"Rep. Category"===t?I("representCategory"):"Add Dept./Body"===t?I("deptbody"):"Academic Year"===t?I("academicyear"):"Menu Data Type"===t?I("menuDataType"):"Menu Data Category"===t?I("menuDataCategory"):"Subjects"===t?I("subject"):"Sections"===t?I("section"):"Grades"===t?I("grade"):"Event Categories"===t&&I("eventCategory")}),[D,t]),(0,a.useEffect)((function(){m(""),document.body.scrollTo(0,0),window.scrollTo(0,0),D.length>0&&(0,Ve.BB)(D).then((function(e){if(console.log("useeffect getting data",o,D),e.error)console.log(e.error);else{var t=e.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));m(t)}}))}),[D,C]);var A=function(e){w(!1),console.log("handle Edit",e),j(!1),p(!0),N(e)},T=function(e,t){window.confirm("Are you sure you want to delete the item?")&&(w(!1),B(e,t))},B=function(e,t){console.log("item in handle delete",D),"subject"===D?(w(!1),console.log("Sending from customMultiComp to delete:",e),(0,Ve.Pl)(e,t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):console.log("MasterItem Deleted response",e),w(!0),F.Am.success("Item Deleted")}))):(w(!1),console.log("Sending Multi master item non subject to delete:",e),(0,Ve.hD)(e,D).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):console.log("MasterItem Deleted response",e),w(!0),F.Am.success("Item Deleted")})))},E=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"80px",style:{textAlign:"center"}},{name:"Name",selector:function(e){return e.name}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return A(e._id)},className:"btn btn-inverse-info p-1",children:M}),"subject"===D?(0,r.jsx)("button",{onClick:function(){return T(e._id,e.gradeId)},className:"btn btn-inverse-danger p-1 mr-5",children:k}):(0,r.jsx)("button",{onClick:function(){return T(e._id)},className:"btn btn-inverse-danger p-1 mr-5",children:k})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"}],_=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"80px",style:{textAlign:"center"}},{name:"Name",selector:function(e){return e.name}},{name:"Grade",selector:function(e){return e.grade.label}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return A(e._id)},className:"btn btn-inverse-info p-1",children:M}),"subject"===D?(0,r.jsx)("button",{onClick:function(){return T(e._id,e.gradeId)},className:"btn btn-inverse-danger p-1 mr-5",children:k}):(0,r.jsx)("button",{onClick:function(){return T(e._id)},className:"btn btn-inverse-danger p-1 mr-5",children:k})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"}];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:l?(0,r.jsx)(r.Fragment,{children:l}):(0,r.jsx)(r.Fragment,{children:t})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:l?(0,r.jsx)(r.Fragment,{children:l}):(0,r.jsx)(r.Fragment,{children:t})})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-right",onClick:function(e){w(!1),j(!0),p(!0)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add New ",t]}),(0,r.jsxs)("div",{children:["Subjects"==t&&(0,r.jsx)(Fe.ZP,{data:u,columns:_,pagination:!0}
1),"Subjects"!=t&&(0,r.jsx)(Fe.ZP,{data:u,columns:E,pagination:!0})]}),h?(0,r.jsx)(Ke,{handleClose:function(){p(!1)},openModal:h,isAddMode:b,form_title:l,menuname:t,masterID:o,masterItem:D,entryformname:n.label,rowId:v,onSubmit:function(){p(!1),w(!0)}}):null,";"]})})})})]})},tt=(n(8215),n(48454)),nt=W()((function(){return Promise.all([n.e(2937),n.e(8446),n.e(4290)]).then(n.t.bind(n,71167,23))}),{loadableGenerated:{webpack:function(){return[71167]}},ssr:!1});var rt=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID),d=e.onSubmit,u=(e.watchFields,e.validate,e.form_title,e.rowId),m=(0,Z.cI)(),f=m.register,h=m.handleSubmit,p=m.reset,x=(m.watch,m.setError,m.setValue),b=m.control,j=(m.clearErrors,m.formState.errors),g=(0,a.useState)({}),v=g[0],N=g[1],y=(0,a.useState)([]),S=y[0],C=y[1],w=(0,a.useState)([]),I=w[0],F=w[1],k=(0,a.useState)([]),M=k[0],A=k[1],T=(0,a.useState)([]),B=T[0],E=T[1];(0,a.useEffect)((function(){console.log("data item check",u),s||u&&Y(u).then((function(e){console.log("data after set",e),N(e),console.log("editdata after set",v)}))}),[]),(0,a.useEffect)((function(){var e=v.description;["service","category","section","title","shortDesc","description","remarks","order","message","excerpt","location","date"].forEach((function(e){return x(e,v[e])})),q((0,c.Z)((0,i.Z)({},O),{description:e}))}),[v]);var _=(0,a.useState)({description:""}),O=_[0],q=_[1];return(0,a.useEffect)((function(){(0,Ve.BB)("Services").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.title,value:e._id}}));C(t),F(e),console.log("service full data",e),console.log("Options data",t)}})),(0,Ve.BB)("Sections").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.title,value:e._id}}));E(t),console.log("section full data",e),console.log("Sections data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:h((function(e){console.log("submitted data",e);var t=u;s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.description=O.description,z(e||[]).then((function(e){p(),q((0,c.Z)((0,i.Z)({},O),{description:""}))}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.description=O.description,J(e,t).then((function(e){p(),q((0,c.Z)((0,i.Z)({},O),{description:""}))}))),d()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Service"}),(0,r.jsx)(Z.Qr,{name:"service",setValue:v.service,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:S,onChange:function(e){t.onChange(e),function(e){console.log("changed data",e),I.map((function(t){if(t._id===e.value){var n=t.category.map((function(e){return{label:e.title,value:e._id}}));console.log("subOptions",n),A(n)}}))}(e)},placeholder:"Select a service",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Category"}),(0,r.jsx)(Z.Qr,{name:"category",setValue:v.category,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:M,placeholder:"Select a category",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Section"}),(0,r.jsx)(Z.Qr,{name:"section",setValue:v.section,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:B,placeholder:"Select a section",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Title",children:"Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},f("title",{required:!0}))),j.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDesc",children:"Short Descr"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDesc",id:"shortDesc"},f("shortDesc",{required:!1})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"description",children:"Description"}),(0,r.jsx)(nt,{value:O.description,onChange:function(e){q((0,c.Z)((0,i.Z)({},O),{description:e}))},modules:tt.J,formats:tt.$,name:"description",id:"description",placeholder:"Write something amazing..."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},f("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})},at=W()((function(){return Promise.all([n.e(9326),n.e(2911)]).then(n.t.bind(n,72911,23))}),{loadableGenerated:{webpack:function(){return[72911]}},ssr:!1});var st=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID),d=e.onSubmit,u=(e.watchFields,e.validate,e.form_title,e.rowId),m=(0,Z.cI)(),f=m.register,h=m.handleSubmit,p=m.reset,x=(m.watch,m.setError,m.setValue),b=m.control,j=(m.clearErrors,m.formState.errors),g=(0,a.useState)({}),v=g[0],N=g[1],y=(0,a.useState)([]),S=y[0],C=y[1],w=(0,a.useState)([]),I=w[0],F=w[1],k=(0,a.useState)([]),M=k[0],A=k[1],T=(0,a.useState)([]),B=T[0],E=T[1],_=(0,a.useRef)(null),O=(0,a.useMemo)((function(){placeholder}),[placeholder]);(0,a.useEffect)((function(){console.log("data item check",u),s||u&&Y(u).then((function(e){console.log("data after set",e),N(e),console.log("editdata after set",v)}))}),[]),(0,a.useEffect)((function(){var e=v.description;
1["service","category","section","title","shortDesc","description","remarks","order","message","excerpt","location","date"].forEach((function(e){return x(e,v[e])})),H((0,c.Z)((0,i.Z)({},R),{description:e}))}),[v]);var q=(0,a.useState)({description:""}),R=q[0],H=q[1];return(0,a.useEffect)((function(){(0,Ve.BB)("Services").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.title,value:e._id}}));C(t),F(e),console.log("service full data",e),console.log("Options data",t)}})),(0,Ve.BB)("Sections").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.title,value:e._id}}));E(t),console.log("section full data",e),console.log("Sections data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:h((function(e){console.log("submitted data",e);var t=u;e.description=R.description,s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.description=R.description,z(e||[]).then((function(e){p(),H((0,c.Z)((0,i.Z)({},R),{description:""}))}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.description=R.description,J(e,t).then((function(e){p(),H((0,c.Z)((0,i.Z)({},R),{description:""}))}))),d()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Service"}),(0,r.jsx)(Z.Qr,{name:"service",setValue:v.service,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:S,onChange:function(e){t.onChange(e),function(e){console.log("changed data",e),I.map((function(t){if(t._id===e.value){var n=t.category.map((function(e){return{label:e.title,value:e._id}}));console.log("subOptions",n),A(n)}}))}(e)},placeholder:"Select a service",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Category"}),(0,r.jsx)(Z.Qr,{name:"category",setValue:v.category,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:M,placeholder:"Select a category",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Section"}),(0,r.jsx)(Z.Qr,{name:"section",setValue:v.section,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:B,placeholder:"Select a section",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Title",children:"Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},f("title",{required:!0}))),j.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDesc",children:"Short Descr"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDesc",id:"shortDesc"},f("shortDesc",{required:!1})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"description",children:"Description"}),(0,r.jsx)(at,{ref:_,value:R.description,config:O,tabIndex:1,onChange:function(e){return t=e,void H((0,c.Z)((0,i.Z)({},R),{description:t}));var t},name:"description",id:"description"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},f("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var lt=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID),c=e.onSubmit,d=(e.watchFields,e.validate,e.form_title,e.rowId),u=(0,Z.cI)(),m=u.register,f=u.handleSubmit,h=u.reset,p=(u.watch,u.setError,u.setValue),x=(u.control,u.clearErrors,u.formState.errors),b=(0,a.useState)({}),j=b[0],g=b[1],v=(0,a.useState)(""),N=(v[0],v[1]);return(0,a.useEffect)((function(){console.log("data item check",d),s||d&&Y(d).then((function(e){console.log("data after set",e),g(e),console.log("editdata after set",j)}))}),[]),(0,a.useEffect)((function(){j.description;["title","academicYear","remarks","order"].forEach((function(e){return p(e,j[e])}))}),[j]),(0,a.useEffect)((function(){(0,Ve.BB)("academicyear").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));N(t),console.log("acyear full data",e),console.log("Options data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:f((function(e){console.log("submitted data",e);var t=d;s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.dataType="Academic Calendar",z(e||[]).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):console.log("Academic Calendar Created",e),F.Am.success("Calendar Created"),h()}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),J(e,t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):console.log("Academic Calendar Updated",e),F.Am.success("Calendar Updated"),h()}))),c()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Title",children:"Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},m("title",{required:!0}))),x.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},m("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var ot=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID),d=e.onSubmit,u=(e.watchFields,e.validate,e.form_title,e.rowId),m=(0,Z.cI)(),f=m.register,h=m.handleSubmit,p=m.reset,x=(m.watch,m.setError,m.setValue),b=m.control,j=(m.clearErrors,m.formState.errors),g=(0,a.useState)({}),v=g[0],N=g[1],y=(0,a.useState)(""),S=y[0],C=y[1];return(0,a.useEffect)((function(){console.log("data item check",u),s||u&&Y(u).then((function(e){console.log("data after set",e),N(e),console.log("editdata after set",v)}))}),[]),(0,a.useEffect)((function(){v.description;
1["title","name","shortDesc2","academicYear","position","order"].forEach((function(e){return x(e,v[e])}))}),[v]),(0,a.useEffect)((function(){(0,Ve.BB)("academicyear").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));C(t),console.log("acyear full data",e),console.log("Options data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:h((function(e){console.log("submitted data",e);var t=u;s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.dataType="Results",e.dataCategory="School Toppers",z(e||[]).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):F.Am.success("Result Created"),p()}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),J(e,t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):console.log("Result Updated",e),F.Am.success("Result Updated"),p()}))),d()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"name",children:"Name"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},f("title",{required:!0}))),j.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDesc2",children:"Roll No."}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDesc2",id:"shortDesc2"},f("shortDesc2",{required:!0}))),j.shortDesc2&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"position",children:"Position"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"position",id:"position"},f("position",{required:!0}))),j.position&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Academic Year"}),(0,r.jsx)(Z.Qr,{name:"academicYear",setValue:v.academicYear,control:b,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:S,placeholder:"Select Academic Year",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},f("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var it=function(){var e=function(){C(!1),D(!1),B(!1),M(!1),J(!0)},t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=t.dataFieldForm,o=t.entryFormTitle,d=t.masterID,u=t.hasImages,m=t.hasCroppedImages,f=t.hasLinks,h=t.hasFiles,p=t.cropWidth,x=t.cropHeight,b=t.menuDataType,j=t.menuDataCategory,g=(0,a.useState)([]),v=g[0],N=g[1],y=(0,a.useState)(!1),S=y[0],C=y[1],w=(0,a.useState)(!1),Z=w[0],D=w[1],I=(0,a.useState)(!1),k=I[0],M=I[1],A=(0,a.useState)(!1),T=A[0],B=A[1],E=(0,a.useState)(!1),_=E[0],O=E[1],q=(0,a.useState)(!0),R=q[0],H=q[1],P=(0,a.useState)(""),G=P[0],L=P[1],U=(0,a.useState)(""),V=U[0],W=U[1],z=(0,a.useState)(!1),Y=z[0],J=z[1],K=(0,a.useState)("img"),ee=K[0],te=K[1],ne=(0,a.useState)(!1),re=(ne[0],ne[1],(0,s.I0)(),(0,r.jsx)("i",{className:"mdi mdi-delete-forever"})),ae=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"}),se=function(e){Q(e).then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));N(t),console.log("site data received useeffect:",e)}}))};(0,a.useEffect)((function(){O(!1);var e=d;window.scrollTo(0,0),se(e)}),[t,Y]);var le=function(){C(!1),B(!1),M(!1)},oe=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"30px",style:{textAlign:"center"}},{name:"Title",maxWidth:"20%",selector:function(e){return e.title}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return t=e._id,J(!1),console.log("handle Edit",t),H(!1),L(t),void("Minor Projects"===n||"Major Projects"===n?D(!0):"Xth Re
1sults"===n||"XIIth Results"===n?M(!0):"Academic Calendar"===n?B(!0):C(!0));var t},className:"btn btn-inverse-info py-1 px-2 me-2",children:ae}),(0,r.jsx)("button",{onClick:function(){return t=e._id,J(!1),console.log("Sending from multiDataComp to delete:",t),void X(t).then((function(e){console.log("DataAddItem saved response",e),J(!0)}));var t},className:"btn btn-inverse-danger py-1 px-2 me-5",children:re}),(u||m)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){L(e),W(t),O(!0),te("img"),console.log("handle Images",t)}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Images"]}),(h||f)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){L(e),W(t),O(!0),te("pdf"),console.log("handle Files",t)}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Files"]})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"},{name:"Active",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"form-check form-switch form-check-inline",children:(0,r.jsx)("input",{className:"form-check-input",type:"checkbox",role:"switch",id:"Switch",defaultChecked:e.isActive,onChange:function(t){return function(e,t){var n=d;e.preventDefault(),$(t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):(F.Am.success("Is Active Updated"),se(n))})),console.log("row id for toggle",t)}(t,e._id)}})})})}}];return(0,r.jsx)(r.Fragment,{children:_?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("h3",{className:"page-title",children:[n," / ",V]}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsxs)("li",{className:"breadcrumb-item active","aria-current":"page",children:[n," / ",V]})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("h4",{className:"card-title",children:[n," / ",V," - Images List"]}),(0,r.jsx)("div",{className:"",children:(0,r.jsx)(Ne,{handleClose:function(){O(!1)},imageComp:_,onSubmit:e,menuname:n,masterID:d,dataID:G,fileModelRef:"SiteData",dataTitle:V,hasLinks:f,hasImages:u,hasFiles:h,hasCroppedImages:m,fileGroup:ee,cropWidth:p,cropHeight:x})})]})})})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-end",onClick:function(e){J(!1),H(!0),"Minor Projects"===n||"Major Projects"===n?D(!0):"Academic Calendar"===n?B(!0):"Xth Results"===n||"XIIth Results"===n?M(!0):C(!0),console.log("menu name in func",n)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add New ",n]}),(0,r.jsxs)("h4",{className:"card-title",children:["Manage"," ",o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})]}),(0,r.jsx)("div",{className:"table-responsive",children:(0,r.jsx)(Fe.ZP,{data:v,columns:oe,pagination:!0})})]})})})}),(0,r.jsxs)("div",{children:[S?(0,r.jsx)(rt,{handleClose:le,openModal:S,isAddMo
1de:R,form_title:o,menuname:n,menuDataType:b,menuDataCategory:j,masterID:d,entryformname:l.label,rowId:G,onSubmit:e,placeholder:"Description"}):null,";"]}),(0,r.jsxs)("div",{children:[Z?(0,r.jsx)(st,{handleClose:le,openModal:S,isAddMode:R,form_title:o,menuname:n,masterID:d,entryformname:l.label,rowId:G,onSubmit:e}):null,";"]}),(0,r.jsxs)("div",{children:[T?(0,r.jsx)(lt,{handleClose:le,openModal:T,isAddMode:R,form_title:o,menuname:n,menuDataType:b,menuDataCategory:j,masterID:d,entryformname:l.label,rowId:G,onSubmit:e}):null,";",k?(0,r.jsx)(ot,{handleClose:le,openModal:k,isAddMode:R,form_title:o,menuname:n,masterID:d,entryformname:l.label,rowId:G,onSubmit:e}):null,";"]})]})})},ct=W()((function(){return Promise.all([n.e(9326),n.e(2911)]).then(n.t.bind(n,72911,23))}),{loadableGenerated:{webpack:function(){return[72911]}},ssr:!1});var dt=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.placeholder),d=e.masterID,u=e.onSubmit,m=(e.watchFields,e.validate,e.form_title,e.rowId),f=e.menuDataCategory,h=e.menuDataType,p=(0,Z.cI)(),x=p.register,b=p.handleSubmit,j=p.reset,g=(p.watch,p.setError,p.setValue),v=p.control,N=(p.clearErrors,p.formState.errors),y=(0,a.useState)({}),S=y[0],C=y[1],w=(0,a.useState)([]),I=w[0],k=w[1],M=(0,a.useState)([]),A=(M[0],M[1],(0,a.useState)([])),T=(A[0],A[1],(0,a.useState)([])),B=(T[0],T[1],(0,a.useRef)(null)),E=(0,a.useMemo)((function(){}),[o]);(0,a.useEffect)((function(){console.log("data item check",m),s||m&&Y(m).then((function(e){console.log("data after set",e),e.date=(0,ue.default)(e.date),e.dateFrom=(0,ue.default)(e.dateFrom),e.dateTo=(0,ue.default)(e.dateTo),C(e),console.log("editdata after set",S)}))}),[]),(0,a.useEffect)((function(){var e=S.description;["dataCategory","title","shortDesc","description","remarks","order","message","excerpt","location","date"].forEach((function(e){return g(e,S[e])})),q((0,c.Z)((0,i.Z)({},O),{description:e}))}),[S]);var _=(0,a.useState)({description:""}),O=_[0],q=_[1];return(0,a.useEffect)((function(){(0,Ve.BB)("eventCategory").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));k(t),console.log("subject full data",e),console.log("subject options data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:b((function(e){console.log("submitted data",e);var t=m;e.menuDataCategory=f,e.menuDataType=h,s&&(e.menuName=l,e.masterID=d,e.dataSlug=(0,ye.Z)(e.title),e.description=O.description,z(e||[]).then((function(e){F.Am.success("Data Added"),j(),q((0,c.Z)((0,i.Z)({},O),{description:""}))}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=d,e.dataSlug=(0,ye.Z)(e.title),e.description=O.description,J(e,t).then((function(e){F.Am.success("Data Updated"),j(),q((0,c.Z)((0,i.Z)({},O),{description:""}))}))),u()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Category"}),(0,r.jsx)(Z.Qr,{name:"dataCategory",setValue:S.dataCategory,control:v,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:I,placeholder:"Select a category",className:"formcontrol"}))}}),N.dataCategory&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Title",children:"Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},x("title",{required:!0}))),N.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDesc",children:"Short Descr"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDesc",id:"shortDesc"},x("shortDesc",{required:!1})))]}),(0,r.jsx)("div",{className:"col-md-6",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Date",children:"Date"}),(0,r.jsx)(Z.Qr,{control:v,name:"date",rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Me(),{timeFormat:"- hh:mm a",dateFormat:"DD/MMM/YYYY",onChange:function(e){return t.onChange(e)},value:t.value,closeOnSelect:!0,inputProps:{readOnly:!0}})}}),N.fileDate&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]},"Date")}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"description",children:"Description"}),(0,r.jsx)(ct,{ref:B,value:O.description,config:E,tabIndex:1,onChange:function(e){return t=e,void q((0,c.Z)((0,i.Z)({},O),{description:t}));var t},name:"description",id:"description"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},x("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var ut=function(){var e=function(){M(!1),_(!1),H(!1),q(!1),ae(!0)},t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=t.dataFieldForm,o=t.entryFormTitle,d=t.masterID,u=t.hasImages,m=t.hasCroppedImages,f=t.hasLinks,h=t.hasFiles,p=t.cropWidth,x=t.cropHeight,b=t.menuDataType,j=t.menuDataCategory,g=(0,Z.cI)(),v=(g.register,g.handleSubmit,g.reset,g.watch,g.setError,g.setValue,g.control),N=(g.clearErrors,g.formState.errors,(0,a.useState)([])),y=N[0],S=N[1],C=(0,a.useState)([]),w=C[0],D=C[1],I=(0,a.useState)(!1),k=I[0],M=I[1],A=(0,a.useState)([]),T=A[0],B=A[1],E=(0,a.useState)(!1),_=(E[0],E[1]),O=(0,a.useState)(!1),q=(O[0],O[1]),R=(0,a.useState)(!1),H=(R[0],R[1]),P=(0,a.useState)(!1),G=P[0],L=P[1],U=(0,a.useState)(!0),V=U[0],W=U[1],z=(0,a.useState)(""),Y=z[0],J=z[1],K=(0,a.useState)(""),ee=K[0],te=K[1],ne=(0,a.useState)(!1),re=ne[0],ae=ne[1],se=(0,a.useState)("img"),le=se[0],oe=se[1],ie=(0,a.useState)(!1),ce=(ie[0],ie[1],(0,s.I0)(),(0,r.jsx)("i",{className:"mdi mdi-delete-forever"})),de=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"}),ue=function(e){Q(e).then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));S(t),D(t),console.log("site data received useeffect:",t)}}))};(0,a.useEffect)((function(){L(!1);var e=d;window.scrollTo(0,0),ue(e)}
1),[t,re]),(0,a.useEffect)((function(){(0,Ve.BB)("eventCategory").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));B(t),console.log("subject full data",e),console.log("subject options data",t)}}))}),[]);var me=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"5%",style:{textAlign:"center"}},{name:"Title",selector:function(e){return e.title},maxWidth:"35%"},{name:"Actions",maxWidth:"35%",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return t=e._id,ae(!1),console.log("handle Edit",t),W(!1),J(t),void M(!0);var t},className:"btn btn-inverse-info py-1 px-2 me-2",children:de}),(0,r.jsx)("button",{onClick:function(){return t=e._id,ae(!1),console.log("Sending from multiDataComp to delete:",t),void X(t).then((function(e){console.log("DataAddItem saved response",e),ae(!0)}));var t},className:"btn btn-inverse-danger py-1 px-2 me-5",children:ce}),(u||m)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){J(e),te(t),L(!0),oe("img"),console.log("handle Images",t)}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Images"]}),(h||f)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){J(e),te(t),L(!0),oe("pdf"),console.log("handle Files",t)}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Files"]})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1},{name:"Active",maxWidth:"15%",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"form-check form-switch form-check-inline",children:(0,r.jsx)("input",{className:"form-check-input",type:"checkbox",role:"switch",id:"Switch",defaultChecked:e.isActive,checked:e.isActive,onChange:function(t){return function(e,t){var n=d;e.preventDefault(),$(t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):(F.Am.success("Is Active Updated"),ue(n))})),console.log("row id for toggle",t)}(t,e._id)}})})})}}];return(0,r.jsx)(r.Fragment,{children:G?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("h3",{className:"page-title",children:[n," / ",ee]}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsxs)("li",{className:"breadcrumb-item active","aria-current":"page",children:[n," / ",ee]})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("h4",{className:"card-title",children:[n," / ",ee," - Images List"]}),(0,r.jsx)("div",{className:"",children:(0,r.jsx)(Ne,{handleClose:function(){L(!1)},imageComp:G,onSubmit:e,menuname:n,masterID:d,dataID:Y,fileModelRef:"SiteData",dataTitle:ee,hasLinks:f,hasImages:u,hasFiles:h,hasCroppedImages:m,fileGroup:le,cropWidth:p,cropHeight:x})})]})})})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-end",onClick:function(e){ae(!1),W(!0),M(!0),console.log("menu name in func",n)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add New ",n]}),(0,r.jsxs)("h4",{className:"card-title",children:["Manages"," ",o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})]}),(0,r.jsx)("div",{children:(0,r.jsx)(Z.Qr,{name:"category",control:v,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:T,onChange:function(e){t.onChange(e),function(e){console.log("changed data",e),y.map((function(t){var n=y.filter((function(t){var n;return(null===(n=t.dataCategory)||void 0===n?void 0:n.value)===e.value}));console.log("filtered Events ",n);var r=n.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));D(r),console.log("subevents",r)}))}(e)},placeholder:"Select an event category",className:"formcontrol"}))}})}),(0,r.jsx)("div",{className:"table-responsive",children:(0,r.jsx)(Fe.ZP,{data:w,columns:me,pagination:!0}
1)})]})})})}),(0,r.jsxs)("div",{children:[k?(0,r.jsx)(dt,{handleClose:function(){M(!1),H(!1),q(!1)},openModal:k,isAddMode:V,form_title:o,menuname:n,menuDataType:b,menuDataCategory:j,masterID:d,entryformname:l.label,rowId:Y,onSubmit:e,placeholder:"Description"}):null,";"]})]})})},mt=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),n=JSON.stringify(t),e.prev=2,e.next=5,M().post(g.bl+"/contact",n,{headers:{"Content-type":"application/json"}});case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),e.t0;case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));return function(t){return e.apply(this,arguments)}}(),ft=function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t,n),r=JSON.stringify(t),console.log("data in axios after stringify",r,n),e.prev=3,e.next=6,M().put(g.bl+"/contact/".concat(n),r,{headers:{"Content-type":"application/json"}},console.log("data sent from axios",r));case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),e.t0;case 11:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(t,n){return e.apply(this,arguments)}}(),ht=function(){var e=(0,h.Z)(x().mark((function e(){var t;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/contact");case 3:return t=e.sent.data,e.abrupt("return",t);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),pt=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/contact/".concat(t));case 3:return n=e.sent.data,console.log("received data",n),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}(),xt=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().delete(g.bl+"/contact/".concat(t));case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 11:case 12:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),bt=W()((function(){return Promise.all([n.e(9326),n.e(2911)]).then(n.t.bind(n,72911,23))}),{loadableGenerated:{webpack:function(){return[72911]}},ssr:!1});var jt=function(e){var t=e.placeholder,n=e.openModal,s=e.handleClose,l=e.isAddMode,o=e.menuname,d=e.masterID,u=e.onSubmit,m=(e.watchFields,e.validate,e.form_title,e.rowId),f=(0,Z.cI)(),h=f.register,p=f.handleSubmit,x=f.reset,b=(f.watch,f.setError,f.setValue),j=f.control,g=(f.clearErrors,f.formState.errors),v=(0,a.useState)({}),N=v[0],y=v[1],S=(0,a.useState)([]),C=S[0],w=S[1],I=(0,a.useState)([]),k=I[0],M=I[1],A=(0,a.useRef)(null),T=(0,a.useState)(""),B=(T[0],T[1],(0,a.useMemo)((function(){}),[t]));(0,a.useEffect)((function(){console.log("data item check",m),l||m&&pt(m).then((function(e){console.log("data after set",e),y(e),console.log("editdata after set",N)}))}),[]),(0,a.useEffect)((function(){var e=N.description;["contactName","designation","qualification","specialization","interestArea","contactType","description","mobile","email"].forEach((function(e){return b(e,N[e])})),O((0,c.Z)((0,i.Z)({},_),{description:e}))}),[N]);var E=(0,a.useState)({description:""}),_=E[0],O=E[1];return(0,a.useEffect)((function(){(0,Ve.BB)("designation").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));w(t),console.log("designation full data",e),console.log("Designation Options data",t)}}))}),[]),(0,a.useEffect)((function(){(0,Ve.BB)("contactType").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));M(t),console.log("UserType full data",e),console.log("UserType Options data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"",show:n,onHide:s,backdrop:"static",size:"xl",className:"menuAddModal",children:[(0,r.jsxs)(D.Z.Header,{children:[(0,r.jsx)(D.Z.Title,{className:"text-center w-100",children:l?(0,r.jsx)("h4",{children:o}):(0,r.jsx)("h2",{children:o})}),(0,r.jsx)("button",{type:"button",className:"btn btn-gradient-danger btn-sm",onClick:s,children:(0,r.jsx)("i",{className:"mdi mdi-close"})})]}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:p((function(e){e.description=_.description;var t=m;l&&(e.menuName=o,e.masterID=d,e.slug=(0,ye.Z)(e.name),e.profile=_.description,mt(e||[]).then((function(e){x(),F.Am.success("User Added"),O((0,c.Z)((0,i.Z)({},_),{description:""}))}))),!l&&(console.log("data for edit",e),e.menuName=o,e.masterID=d,e.slug=(0,ye.Z)(e.title),e.profile=_.description,ft(e,t).then((function(e){x(),F.Am.success("User Updated"),O((0,c.Z)((0,i.Z)({},_),{description:""}))}))),u()})),className:"px-5",children:[(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-lg-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"contactName",children:"Name"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"contactName",id:"contactName"},h("contactName",{required:!0}))),g.contactName&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsx)("div",{className:"form-group",children:C.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"Designation"}),(0,r.jsx)(Z.Qr,{name:"designation",setValue:N.designation,control:j,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:C,placeholder:"Select a designation",className:"mb-4"}))}})]})}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"mobile",children:"Mobile"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"mobile",id:"mobile"},h("mobile",{required:!1})))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"specialization",children:"Specialization"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"specialization",id:"sspecialization"},h("specialization",{required:!1})))]})]}),(0,r.jsxs)("div",{className:"col-lg-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"qual
1ification",children:"Qualification"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"qualification",id:"qualification"},h("qualification",{required:!1})))]}),(0,r.jsx)("div",{className:"form-group",children:k.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"User Type"}),(0,r.jsx)(Z.Qr,{name:"contactType",setValue:N.contactType,control:j,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:k,placeholder:"Select a user type",className:"mb-4"}))}})]})}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"email",children:"Email"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"email",name:"email",id:"email"},h("email",{required:!1})))]}),(0,r.jsx)("div",{className:"form-group"}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"interestArea",children:"Area of Interest"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"interestArea",id:"interestArea"},h("interestArea",{required:!1})))]})]}),(0,r.jsx)("div",{className:"col-md-12",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"description",children:"Profile"}),(0,r.jsx)(bt,{ref:A,value:_.description,config:B,tabIndex:1,onChange:function(e){return t=e,void O((0,c.Z)((0,i.Z)({},_),{description:t}));var t},name:"description",id:"description"})]})}),(0,r.jsxs)("div",{className:"col-lg-12 text-center",children:[(0,r.jsx)("button",{className:"btn btn-primary me-2",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger",type:"submit",onClick:function(){return s()},children:"Close"})]})]})})}),(0,r.jsx)("br",{})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var gt=function(){var e=function(){N(!1),O(!0),console.log("onSubmit has run !")},t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=(t.dataFieldForm,t.entryFormTitle),o=t.masterID,d=t.hasImages,u=t.hasCroppedImages,m=t.hasLinks,f=t.hasFiles,h=t.cropWidth,p=t.cropHeight,x=(0,a.useState)([]),b=x[0],j=x[1],g=(0,a.useState)(!1),v=g[0],N=g[1],y=(0,a.useState)(!1),S=y[0],C=y[1],w=(0,a.useState)(!0),Z=w[0],D=w[1],I=(0,a.useState)(""),k=I[0],M=I[1],A=(0,a.useState)(""),T=A[0],B=A[1],E=(0,a.useState)(!1),_=E[0],O=E[1],q=(0,a.useState)("img"),R=q[0],H=q[1],P=((0,s.I0)(),(0,r.jsx)("i",{className:"mdi mdi-delete-forever"})),G=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"});(0,a.useEffect)((function(){C(!1),document.body.scrollTo(0,0);ht().then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));t.map((function(e){"undefined"===e.contactType&&(e.contactType.label="General",e.contactType.value="63b46f0249a1c68cf7f9218f")})),j(t),console.log("site data received useeffect:",e),console.log("Contact Data after set:",b)}}))}),[_]);var L=function(e){O(!1),xt(e).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):O(!0),F.Am.success("Contact Deleted")}))},U=[{name:"Sl.No",selector:function(e){return e.slno},sortable:!0,width:"10%",style:{textAlign:"center"}},{name:"User Name",selector:function(e){return e.contactName},sortable:!0,width:"30%"},{name:"User Type",selector:function(e){return e.contactType.label},sortable:!0,width:"20%"},{name:"Actions",width:"40%",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return t=e._id,O(!1),console.log("handle Edit",t),D(!1),N(!0),void M(t);var t},className:"btn btn-inverse-info py-1 px-2 me-2",children:G}),(0,r.jsx)("button",{onClick:function(){return t=e._id,void(window.confirm("Are you sure you want to delete the User?")&&(O(!1),L(t)));var t},className:"btn btn-inverse-danger py-1 px-2",children:P}),(d||u)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){M(e),B(t),C(!0),H("img")}(e._id,e.title)},className:"btn btn-outline-success btn-sm py-1 px-2 ms-4",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Images"]}),(f||m)&&(0,r.jsxs)("span",{onClick:function(){return function(e,t){M(e),B(t),C(!0),H("pdf")}(e._id,e.title)},className:"btn btn-outline-success btn-sm ms-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Files & Links"]})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1}
1];return console.log("Contact Data after set II:",b),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:l?(0,r.jsx)(r.Fragment,{children:l}):(0,r.jsx)(r.Fragment,{children:n})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:l?(0,r.jsx)(r.Fragment,{children:l}):(0,r.jsx)(r.Fragment,{children:n})})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[S?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"",children:(0,r.jsxs)("h4",{children:[n," - ",T]})})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"",children:l?(0,r.jsx)("h4",{children:l}):(0,r.jsx)("h4",{children:n})}),(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-end",onClick:function(e){O(!1),D(!0),N(!0)},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add News ",n]})]}),(0,r.jsx)("div",{children:S?(0,r.jsx)(Ne,{handleClose:function(){C(!1)},imageComp:S,onSubmit:e,menuname:n,masterID:o,dataID:k,contID:k,fileModelRef:"Contact",dataTitle:T,hasLinks:m,hasImages:d,hasFiles:f,hasCroppedImages:u,fileGroup:R,cropWidth:h,cropHeight:p}):(0,r.jsx)(Fe.ZP,{data:b,columns:U,pagination:!0})}),v?(0,r.jsx)(jt,{handleClose:function(){N(!1)},openModal:v,isAddMode:Z,form_title:l,placeholder:"Description",menuname:n,masterID:o,rowId:k,contId:k,onSubmit:e}):null]})})})})]})},vt=function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),r=JSON.stringify(t),e.prev=2,e.next=5,M().post(g.bl+"/deptBodyRole",r,{headers:{"Content-type":"application/json"}}).then((function(e){console.log("axios response",e),n(e)})).catch((function(e){console.log("Axios response received role error response",e.response.data),n(e)}));case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),e.t0;case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));return function(t,n){return e.apply(this,arguments)}}(),Nt=function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t,n),r=JSON.stringify(t),console.log("data in axios after stringify",r),e.prev=3,e.next=6,M().put(g.bl+"/deptBodyRole",r,{headers:{"Content-type":"application/json"}});case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),e.t0;case 11:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(t,n){return e.apply(this,arguments)}}(),yt=function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios role id",t),console.log("data in axios dept body",n),e.prev=2,e.next=5,M().delete(g.bl+"/deptBodyRole",{headers:{"Content-type":"application/json"},data:{deptBodyId:n,roleId:t}});case 5:return r=e.sent,e.abrupt("return",r);case 9:throw e.prev=9,e.t0=e.catch(2),e.t0;case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t,n){return e.apply(this,arguments)}}(),St=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.log("axios dept Body",t),e.next=4,M().get(g.bl+"/deptBodyRoleUser/".concat(t));case 4:return n=e.sent.data,e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}(),Ct=function(){var e=(0,h.Z)(x().mark((function e(t){var n,r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),n=JSON.stringify(t),e.prev=2,e.next=5,M().post(g.bl+"/deptBodyRoleUser",n,{headers:{"Content-type":"application/json"}});case 5:return r=e.sent,e.abrupt("return",r);case 9:throw e.prev=9,e.t0=e.catch(2),e.t0;case 12:case"end":return e.stop()}}),e,null,[[2,9]])}
1)));return function(t){return e.apply(this,arguments)}}(),wt=function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),e.prev=1,e.next=4,M().delete(g.bl+"/deptBodyRoleUser",{headers:{"Content-type":"application/json"},data:t});case 4:return n=e.sent,e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(1),e.t0;case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}();var Zt=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=e.onSubmit,o=(e.form_title,e.rowId),c=e.roledata,d=e.selDB,u=(0,Z.cI)({defaultValues:{roleName:"",roleMaxNo:"",roleOrder:""}}),m=u.register,f=u.handleSubmit,p=u.reset,b=(u.watch,u.setError,u.setValue),j=(u.control,u.clearErrors,u.formState.errors),g=(0,a.useState)({}),v=g[0],N=g[1],y=(0,a.useState)({}),S=y[0],C=(y[1],(0,a.useState)([])),w=C[0];C[1],(0,a.useEffect)((function(){window.scrollTo(0,0),console.log("data item check",o),console.log("selDB from role add form",d),s||o.length>0&&(N(c),console.log("editdata after set",v))}),[]),(0,a.useEffect)((function(){["roleName","roleMaxNo","roleOrder"].forEach((function(e){return b(e,v[e])})),console.log("editdata set to formfields",v)}),[v]),console.log("Options from add form",w);var I=function(){var e=(0,h.Z)(x().mark((function e(t){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.deptBodyId=d._id,t.roleData=S,t.roleData.roleName=t.roleName,t.roleData.roleMaxNo=t.roleMaxNo,t.roleData.roleOrder=t.roleOrder,"",e.t0=s,!e.t0){e.next=11;break}return e.next=10,vt(t,(function(e){console.log("final response if response",e.response.data),"failed"===e.response.data.status&&(console.log("final response if failed response",e.response.data.message),F.Am.error(e.response.data.message)),l()})).catch((function(e){}));case 10:e.sent;case 11:!s&&(t.roleId=o,console.log("data for edit",t),Nt(t).then((function(e){console.log("DataAddItem saved response",e),p(),l()})));case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:s?"Add New Role":"Edit Role"})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:f(I),children:[(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsx)("h2",{children:"Role add"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"roleName",children:"Role Name"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"roleName",id:"roleName"},m("roleName",{required:!0}))),j.roleName&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"roleMaxNo",children:"Max. Nos."}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",name:"roleMaxNo",id:"roleMaxNo"},m("roleMaxNo",{required:!0}))),j.roleMaxNo&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"roleOrder",children:"Max. Nos."}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",name:"roleOrder",id:"roleOrder"},m("roleOrder",{required:!1})))]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})},Dt=W()((function(){return Promise.all([n.e(9326),n.e(2911)]).then(n.t.bind(n,72911,23))}),{loadableGenerated:{webpack:function(){return[72911]}},ssr:!1});var It=function(e){var t=e.placeholder,n=(e.openModal,e.handleClose),s=e.isAddMode,l=e.menuname,o=e.masterID,d=e.onSubmit,u=(e.watchFields,e.validate,e.form_title,e.rowId),m=(0,Z.cI)(),f=m.register,h=m.handleSubmit,p=m.reset,x=(m.watch,m.setError,m.setValue),b=m.control,j=(m.clearErrors,m.formState.errors),g=(0,a.useState)({}),v=g[0],N=g[1],y=(0,a.useState)([]),S=y[0],C=y[1],w=(0,a.useState)([]),I=w[0],k=w[1],M=(0,a.useRef)(null),A=(0,a.useMemo)((function(){}),[t]);(0,a.useEffect)((function(){console.log("data item check",u),s||u&&pt(u).then((function(e){console.log("data after set",e),N(e),console.log("editdata after set",v)}))}),[]),(0,a.useEffect)((function(){var e=v.description;["contactName","designation","qualification","specialization","interestArea","contactType","description","mobile","email"].forEach((function(e){return x(e,v[e])})),E((0,c.Z)((0,i.Z)({},B),{description:e}))}),[v]);var T=(0,a.useState)({description:""}),B=T[0],E=T[1];return(0,a.useEffect)((function(){(0,Ve.BB)("designation").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));C(t),console.log("designation full data",e),console.log("Designation Options data",t)}}))}),[]),(0,a.useEffect)((function(){(0,Ve.BB)("contactType").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));
1k(t),console.log("UserType full data",e),console.log("UserType Options data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"",show:openModals,onHide:n,backdrop:"static",size:"xl",className:"menuAddModal",children:[(0,r.jsxs)(D.Z.Header,{children:[(0,r.jsx)(D.Z.Title,{className:"text-center w-100",children:s?(0,r.jsx)("h4",{children:l}):(0,r.jsx)("h2",{children:l})}),(0,r.jsx)("button",{type:"button",className:"btn btn-gradient-danger btn-sm",onClick:n,children:(0,r.jsx)("i",{className:"mdi mdi-close"})})]}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:h((function(e){console.log("submitted data",e);var t=u;e.description=B.description,s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.name),e.profile=B.description,mt(e||[]).then((function(e){p(),F.Am.success("User Added"),E((0,c.Z)((0,i.Z)({},B),{description:""}))}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),e.profile=B.description,ft(e,t).then((function(e){p(),F.Am.success("User Updated"),E((0,c.Z)((0,i.Z)({},B),{description:""}))}))),d()})),className:"px-5",children:[(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:"col-lg-12",children:(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-lg-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"contactName",children:"Name"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"contactName",id:"contactName"},f("contactName",{required:!0}))),j.contactName&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsx)("div",{className:"form-group",children:S.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"Designation"}),(0,r.jsx)(Z.Qr,{name:"designation",setValue:v.designation,control:b,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:S,placeholder:"Select a designation",className:"mb-4"}))}})]})}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"mobile",children:"Mobile"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"mobile",id:"mobile"},f("mobile",{required:!1})))]}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"specialization",children:"Specialization"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"specialization",id:"sspecialization"},f("specialization",{required:!1})))]})]}),(0,r.jsxs)("div",{className:"col-lg-6",children:[(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"qualification",children:"Qualification"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"qualification",id:"qualification"},f("qualification",{required:!1})))]}),(0,r.jsx)("div",{className:"form-group",children:I.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("label",{className:"formlabel",children:"User Type"}),(0,r.jsx)(Z.Qr,{name:"contactType",setValue:v.contactType,control:b,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:I,placeholder:"Select a user type",className:"mb-4"}))}})]})}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"email",children:"Email"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"email",name:"email",id:"email"},f("email",{required:!1})))]}),(0,r.jsx)("div",{className:"form-group"}),(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"interestArea",children:"Area of Interest"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"interestArea",id:"interestArea"},f("interestArea",{required:!1})))]})]}),(0,r.jsx)("div",{className:"col-md-12",children:(0,r.jsxs)("div",{className:"form-group",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"description",children:"Profile"}),(0,r.jsx)(Dt,{ref:M,value:B.description,config:A,tabIndex:1,onChange:function(e){return t=e,void E((0,c.Z)((0,i.Z)({},B),{description:t}));var t},name:"description",id:"description"})]})}),(0,r.jsxs)("div",{className:"col-lg-12 text-center",children:[(0,r.jsx)("button",{className:"btn btn-primary me-2",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger",type:"submit",onClick:function(){return n()},children:"Close"})]})]})})}),(0,r.jsx)("br",{})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var Ft=function(){var e=function(){y(!1),g(!1),T(!0)},t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=(t.formCategory,t.dataFieldForm,t.entryFormTitle),o=t.masterID,d=(t.hasImages,t.hasCroppedImages,t.hasLinks,t.hasFiles,t.cropWidth,t.cropHeight,(0,Z.cI)()),u=(d.register,d.handleSubmit),m=d.reset,f=(d.watch,d.setError,d.setValue,d.control),h=(d.clearErrors,d.formState.errors,(0,a.useState)()),p=h[0],x=h[1],b=(0,a.useState)(!1),j=b[0],g=b[1],v=(0,a.useState)(!1),N=v[0],y=v[1],S=(0,a.useState)(!0),C=S[0],w=S[1],D=(0,a.useState)(""),I=D[0],F=D[1],k=(0,a.useState)(""),M=(k[0],k[1],(0,a.useState)(!1)),A=M[0],T=M[1],B=(0,a.useState)(""),E=(B[0],B[1],(0,a.useState)({})),_=E[0],O=(E[1],(0,a.useState)({})),q=O[0],R=(O[1],(0,a.useState)([""])),H=R[0],P=R[1],G=(0,a.useState)([""]),L=G[0],U=G[1],V=(0,a.useState)([""]),W=V[0],z=V[1],Q=(0,a.useState)(""),Y=Q[0],J=Q[1],X=(0,a.useState)([""]),$=X[0],K=X[1],ee=(0,a.useState)(""),te=ee[0],ne=ee[1],re=(0,a.useState)(""),ae=re[0],se=re[1],le=(0,r.jsx)("i",{className:"mdi mdi-delete-forever"}),oe=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"});(0,a.useEffect)((function(){window.scrollTo(0,0);(0,Ve.BB)("deptbody").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));P(t),U(e)}}))}),[ae,A]),(0,a.useEffect)((function(){(0,Ve.BB)("contactType").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));ne(t)}}))}),[]),(0,a.useEffect)((function(){ht().then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.contactName,value:e._id}}));J(t),K(e)}}))}),[A]);var ie=function(){y(!1),g(!1)},ce=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"80px",style:{textAlign:"center"}},{name:"Name",selector:function(e){return e.contact.contactName}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return t=e._id,T(!1),console.log("handle Edit",t),w(!1),setopenModal(!0),void F(t);var t},className:"btn btn-inverse-info p-1",children:oe}),(0,r.jsx)("button",{onClick:function(){return function(e){var t=n;T(!1),(0,Ve.hD)(e,t).then((function(e){T(!0)}))}(e._id)},className:"btn btn-inverse-danger p-1 mr-5",children:le})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"}];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"pagetitle",children:(0,r.jsx)("div",{className:"mt-2 d-flex flex-row ml-3 justify-content-between align-items-center",children:(0,r.jsx)("div",{className:"",children:l?(0,r.jsx)("h4",{children:l}):(0,r.jsx)("h4",{children:n})})})}),(0,r.jsx)("div",{className:"onSubmit={handleSubmit(handleForm)}",children:(0,r.jsxs)("form",{onSubmit:u((function(e){e.newuser=_,e.newuserrole=q,e.newuserrole.deptBody=props.deptBody,e.newuserrole.role=e.deptBodyRole.value,e.deptBodyId=e.deptBody.value,e.roleName=e.deptBodyRole.label,e.newuser.contact=e.user.value,Ct(e).then((function(e){m()}))})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Dept.Body"}),(0,r.jsx)(Z.Qr,{name:"deptBody",control:f,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:H,onChange:function(e){t.onChange(e),function(e){console.log("changed data value coming",e),console.log("option Data for changed data value coming",L);var t=e.value;St(t).then((function(e){if(e.error)console.log(e.error);else{var t=e.roles.map((function(e){return{label:e.roleName,value:e._id}}));z(t),se(e)}}))}(e)},placeholder:"Select Dept.Body",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{className:"",children:[(0,r.jsx)("div",{children:(0,r.jsx)("label",{className:"formlabel mb-0 mt-2",children:"Select User Role"})}),(0,r.jsxs)("div",{className:"mt-2 d-flex align-items-start ",children:[(0,r.jsx)("div",{className:"col-md-9 p-0",children:(0,r.jsx)(Z.Qr,{name:"deptBodyRole",control:f,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:W,onChange:function(e){t.onChange(e),function(e){console.log("User role changed data value coming",e),ae.roles.map((function(t){if(t._id===e.value){var n=t.roleContacts.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));x(n)}}))}(e)},placeholder:"Select User Role",className:"formcontrol"}))}})}),(0,r.jsx)("span",{className:"btn btn-sm btn-success p-1",children:(0,r.jsx)("i",{className:"mdi mdi-plus-circle",onClick:function(){T(!1),w(!0),g(!0)}})})]})]}),(0,r.jsxs)("div",{className:"mt-2 d-flex row justify-content-start align-items-center",children:[(0,r.jsxs)("div",{className:"col-md-3",children:[(0,r.jsx)("label",{className:"formlabel",children:"Select User Type"}),(0,r.jsx)(Z.Qr,{name:"userType",control:f,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:te,onChange:function(e){t.onChange(e),function(e){$.length>0&&J([]);var t=$.filter((function(t){return t.contactType.value===e.value}));t.length>0&&J([]);var n=t.map((function(e){return{label:e.contactName,value:e._id}}));J(n)}(e)},placeholder:"Select User Type",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("label",{className:"formlabel",children:"Select User"}),(0,r.jsx)(Z.Qr,{name:"user",control:f,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:Y,placeholder:"Select User",className:"formcontrol"}))}})]}),(0,r.jsx)("span",{className:"btn btn-primary ml-5",type:"",onClick:function(){return T(!1),w(!0),void y(!0)},children:"Add User"})]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Add To Role"})]})}),(0,r.jsx)("div",{children:(0,r.jsx)(Fe.ZP,{data:p,columns:ce,pagination:!0}
1)}),j?(0,r.jsx)(Zt,{handleClose:ie,openModal:j,isAddMode:C,form_title:l,selDB:ae,rowId:I,onSubmit:e}):null,";",N?(0,r.jsx)(It,{handleClose:ie,openModal:N,isAddMode:!0,menuname:n,masterID:o,rowId:"",onSubmit:e}):null,";"]})};var kt=function(){var e=(0,s.v9)((function(e){return e.selmenu.selitem})),t=e.menuName,n=(e.formCategory,e.dataFieldForm,e.entryFormTitle),l=(e.masterID,e.hasImages,e.hasCroppedImages,e.hasLinks,e.hasFiles,e.cropWidth,e.cropHeight,(0,Z.cI)()),o=(l.register,l.handleSubmit),d=l.reset,u=(l.watch,l.setError,l.setValue,l.control),m=(l.clearErrors,l.formState.errors,(0,a.useState)()),f=m[0],h=m[1],p=(0,a.useState)(!1),x=p[0],b=p[1],j=(0,a.useState)(!0),g=j[0],v=j[1],y=(0,a.useState)(""),S=y[0],C=y[1],w=(0,a.useState)(""),D=w[0],I=w[1],F=(0,a.useState)(!1),k=F[0],M=F[1],A=(0,a.useState)(""),T=(A[0],A[1],(0,a.useState)([])),B=T[0],E=T[1],_=(0,a.useState)([]),O=_[0],q=_[1],R=(0,a.useState)(""),H=R[0],P=R[1],G=(0,a.useState)(""),L=G[0],U=G[1],V=(0,r.jsx)("i",{className:"mdi mdi-delete-forever"}),W=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"}),z="deptbody",Q=function(e){q([]),E([]),(0,Ve.BB)(e).then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));E(t),q(e),console.log("deptBody full data",e,O),console.log("Sel Dept Body received inside useeffect 1:",H)}}))};(0,a.useEffect)((function(){document.body.scrollTo(0,0),window.scrollTo(0,0),Q(z)}),[k]);var Y=function(e){U(e);e.label;O.map((function(t){if(t._id===e.value){var n=t.roles.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));h(n),P(t)}}))};console.log("Sel Dept Body Roles received out of useeffect:",f);var J=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"80px",style:{textAlign:"center"}},{name:"Name",selector:function(e){return e.roleName}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return function(e,t){M(!1),console.log("handle Edit",e,t),v(!1),b(!0),C(e),I(t)}(e._id,e)},className:"btn btn-inverse-info p-1",children:W}),(0,r.jsx)("button",{onClick:function(){return function(e){var t=H._id;M(!1),console.log("Sending Role to delete:",e),console.log("Sending Role deptBody:",t),console.log("Sending selDB:",H),yt(e,t).then((function(e){console.log("Dept Body Role Deleted response",e),M(!0)})),M(!0)}(e._id)},className:"btn btn-inverse-danger p-1 mr-5",children:V})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"}];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"pagetitle",children:(0,r.jsxs)("div",{className:"mt-2 d-flex flex-row ml-3 justify-content-between align-items-center",children:[(0,r.jsx)("div",{className:"",children:n?(0,r.jsx)("h4",{children:n}):(0,r.jsx)("h4",{children:t})}),H&&(0,r.jsx)("div",{className:"mr-3",children:(0,r.jsx)(N.G,{icon:ne.EQ8,size:"2xl",onClick:function(e){M(!1),v(!0),b(!0)},className:"multiicon"})})]})}),(0,r.jsx)("div",{className:"",children:(0,r.jsx)("form",{onSubmit:o((function(e){console.log("submitted data",e)})),children:(0,r.jsx)("div",{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Dept.Body"}),(0,r.jsx)(Z.Qr,{name:"deptBody",control:u,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:B,onChange:function(e){t.onChange(e),Y(e)},placeholder:"Select Dept.Body",className:"formcontrol"}))}})]})})})}),(0,r.jsx)("div",{children:(0,r.jsx)(Fe.ZP,{data:f,columns:J,pagination:!0})}),x?(0,r.jsx)(Zt,{handleClose:function(){b(!1)},openModal:x,isAddMode:g,form_title:n,selDB:H,roledata:D,rowId:S,onSubmit:function(){b(!1),Q(z),Y(L),M(!0),console.log("new Value for data",L),console.log("new master items for data table",f),d()}}):null,";"]})},Mt=n(29815);var At=function(e){var t=function(){w(!1),y(!1),E(!0)},n=(0,s.v9)((function(e){return e.selmenu.selitem})),l=n.menuName,o=(n.formCategory,n.dataFieldForm,n.entryFormTitle),d=n.masterID,u=(n.hasImages,n.hasCroppedImages,n.hasLinks,n.hasFiles,n.cropWidth,n.cropHeight,(0,Z.cI)()),m=u.register,f=u.handleSubmit,h=u.reset,p=(u.watch,u.setError,u.setValue,u.control),x=(u.clearErrors,u.formState.errors),b=(0,a.useState)(),j=b[0],g=b[1],v=(0,a.useState)(!1),N=v[0],y=v[1],S=(0,a.useState)(!1),C=S[0],w=S[1],D=(0,a.useState)(!0),I=D[0],F=D[1],k=(0,a.useState)(""),M=k[0],A=(k[1],(0,a.useState)("")),T=(A[0],A[1],(0,a.useState)(!1)),B=T[0],E=T[1],_=(0,a.useState)(""),O=(_[0],_[1],(0,a.useState)({})),q=O[0],R=(O[1],(0,a.useState)({})),H=R[0],P=(R[1],(0,a.useState)({})),G=P[0],L=(P[1],(0,a.useState)([""])),U=(L[0],L[1],(0,a.useState)([""])),V=(U[0],U[1],(0,a.useState)([""])),W=V[0],z=V[1],Q=(0,a.useState)(""),Y=Q[0],J=Q[1],X=(0,a.useState)([""]),$=X[0],K=X[1],ee=(0,a.useState)(""),te=ee[0],ne=ee[1],re=(0,a.useState)(""),ae=(re[0],re[1],(0,a.useState)("")),se=ae[0],le=ae[1],oe=(0,a.useState)(""),ie=oe[0],ce=oe[1],de=(0,a.useState)(""),ue=(de[0],de[1]),me=(0,r.jsx)("i",{className:"mdi mdi-delete-forever"}),fe=function(){var t=e.deptBody;St(t).then((function(e){if(e.error)console.log(e.error);else{var t=e.roles;Object.values(t).map((function(e){var t=e.roleContacts.map((function(e){return{contactId:e.contact._id,contactName:e.contact.contactName}}));t.forEach((function(e){var t=e.contactId;console.log("roleContact thru value id out",t),ue((function(e){return(0,Mt.Z)(e).concat([t])}))})),console.log("roleContact thru value obj out",t)}));var n=e.roles.map((function(e){return{label:e.roleName,value:e._id}}));z(n),le(e),ie.length>0&&he(ie)}}))};(0,a.useEffect)((function(){document.body.scrollTo(0,0),g(""),ce(""),fe()}),[B,n]),(0,a.useEffect)((function(){(0,Ve.BB)("contactType").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));ne(t),console.log("designation full data",e)}}))}),[B,n]),(0,a.useEffect)((function(){ht().then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.contactName,value:e._id}}));J(t),K(e)}}))}),[B,n]);var he=function(e){console.log("User role changed data value coming",e),ce(e),console.log("rolecontact",se.roles),se.roles.map((function(t){if(t._id===e.value){var n=t.roleContacts.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));g(n)}}))},pe=function(t,n,r){G.roleContactId=t,G.userId=r,G.userName=n,G.deptBodyId=e.deptBody,G.userRoleName=ie.label,G.userRoleId=ie.value,console.log("Sending from add official comp to remove from role:",G),wt(G).then((function(e){console.log("Role User Removed response",e),E(!0),h(),fe()}
1))},xe=function(){w(!1),y(!1)},be=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"80px",style:{textAlign:"center"}},{name:"Name",selector:function(e){return e.contact.contactName}},{name:"Rep.Category",selector:function(e){return e.representation}},{name:"Order",selector:function(e){return e.contactOrder}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("button",{onClick:function(){return t=e._id,n=e.contact.contactName,r=e.contact._id,void(window.confirm("Are you sure you want to remove the User from the role?")&&(E(!1),pe(t,n,r)));var t,n,r},className:"btn btn-inverse-danger p-1 mr-5",children:me})})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"}];return console.log("DeptBodyRole options Data in out of map",W),console.log("roleUsers outside functions",j),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"pagetitle",children:(0,r.jsx)("div",{className:"mt-2 d-flex flex-row ml-3 justify-content-between align-items-center",children:(0,r.jsx)("div",{className:"",children:o?(0,r.jsx)("h4",{children:o}):(0,r.jsx)("h4",{children:l})})})}),(0,r.jsx)("div",{className:"",children:(0,r.jsxs)("form",{onSubmit:f((function(n){E(!1),n.newuser=q,n.newuserrole=H,n.newuserrole.deptBody=e.deptBody,n.newuserrole.role=n.deptBodyRole.value,n.deptBodyId=e.deptBody,n.roleName=n.deptBodyRole.label,n.roleId=n.deptBodyRole.value,n.newuser.contact=n.user.value,n.newuser.representation=n.representation,n.newuser.contactOrder=n.roleContactOrder,console.log("sending to dept Body actions",n),Ct(n).then((function(e){console.log("DataAddItem saved response",e),h(),fe(),t()}))})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"",children:[(0,r.jsx)("div",{children:(0,r.jsx)("label",{className:"formlabel mb-0 mt-2",children:"Select User Role"})}),(0,r.jsxs)("div",{className:"mt-2 d-flex align-items-start ",children:[(0,r.jsx)("div",{className:"col-md-9 p-0",children:(0,r.jsx)(Z.Qr,{name:"deptBodyRole",control:p,defaultValue:"",rules:{required:!0},styles:{border:x.deptBodyRole,"1px solid red":""},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:W,onChange:function(e){t.onChange(e),he(e)},placeholder:"Select User Role",className:"formcontrol"}))}})}),(0,r.jsx)("span",{className:"btn btn-primary ml-5",type:"",onClick:function(){return E(!1),F(!0),void y(!0)},children:"Add Role"})]})]}),(0,r.jsxs)("div",{className:"mt-2 d-flex row justify-content-start align-items-center",children:[(0,r.jsxs)("div",{className:"col-md-3",children:[(0,r.jsx)("label",{className:"formlabel",children:"Select User Type"}),(0,r.jsx)(Z.Qr,{name:"userType",defaultValue:"",control:p,render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:te,onChange:function(e){t.onChange(e),function(e){console.log("user type changed data value coming",e),console.log("User option Data for changed data value coming",$),$.length>0&&J([]),console.log("User option Data in map",$),console.log("User options Data in map",Y);var t=$.filter((function(t){return t.contactType.value===e.value}));t.length>0&&J([]);var n=t.map((function(e){return{label:e.contactName,value:e._id}}));J(n)}(e)},placeholder:"Select User Type",className:"formcontrol"}))}})]}),(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("label",{className:"formlabel",children:"Select User"}),(0,r.jsx)(Z.Qr,{name:"user",defaultValue:"",control:p,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:Y,placeholder:"Select User",className:"formcontrol"}))}})]}),(0,r.jsx)("div",{className:"mt-4 col-md-2",children:(0,r.jsx)("span",{className:"btn btn-primary ml-5",type:"",onClick:function(){return E(!1),F(!0),void w(!0)},children:"Add User"})})]}),(0,r.jsxs)("div",{className:"row",children:[(0,r.jsxs)("div",{className:"col-md-6",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"representation",children:"Rep.Category"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"representation",id:"representation"},m("representation",{required:!1})))]}),(0,r.jsxs)("div",{className:"col-md-3",children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"roleContactOrder",children:"Role Contact Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",name:"roleContactOrder",id:"roleContactOrder"},m("roleContactOrder",{required:!1})))]})]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Add To Role"})]})}),(0,r.jsx)("div",{children:(0,r.jsx)(Fe.ZP,{data:j,columns:be,pagination:!0}
1)}),N?(0,r.jsx)(Zt,{handleClose:xe,openModal:N,isAddMode:I,form_title:o,selDB:se,rowId:M,onSubmit:t}):null,";",C?(0,r.jsx)(It,{handleClose:xe,openModal:C,isAddMode:!0,menuname:l,masterID:d,rowId:"",onSubmit:t}):null,";"]})};var Tt=function(e){var t=e.openModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID),d=e.onSubmit,u=(e.watchFields,e.validate,e.form_title,e.rowId),m=e.menuDataType,f=e.menuDataCategory,h=e.acYear,p=e.grade,x=(0,Z.cI)(),b=x.register,j=x.handleSubmit,g=x.reset,v=(x.watch,x.setError,x.setValue),N=x.control,y=(x.clearErrors,x.formState.errors),S=(0,a.useState)({}),C=S[0],w=S[1],I=(0,a.useState)([]),k=I[0],M=I[1],A=(0,a.useState)(""),T=A[0],B=A[1];console.log("ac year:",h,"grade :",p),(0,a.useEffect)((function(){console.log("data item check",u),s||u&&Y(u).then((function(e){console.log("data after set",e),w(e),console.log("editdata after set",C)}))}),[]),(0,a.useEffect)((function(){["title","shortDesc","subject","order"].forEach((function(e){return v(e,C[e])}))}),[C]);var E=(0,a.useState)({description:""});return E[0],E[1],(0,a.useEffect)((function(){(0,Ve.BB)("subject").then((function(e){if(e.error)console.log(e.error);else{var t=e.filter((function(e){return e.grade.value===p.value})).map((function(e){return{label:e.name,value:e._id}}));M(t),console.log("subject full data",e),console.log("subject options data",t)}}))}),[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:j((function(e){console.log("submitted data",e);var t=u;e.menuDataType=m,e.menuDataCategory=f,e.academicYear=h,e.grade=p,e.subject=T,s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),z(e||[]).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):F.Am.success("Item Created"),g()}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),J(e,t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):F.Am.success("Downloade Item Updated"),g()}))),d()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",children:"Select Subject"}),(0,r.jsx)(Z.Qr,{name:"subject",setValue:C.subject,control:N,rules:{required:!0},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:k,onChange:function(e){t.onChange(e),B(e)},placeholder:"Select a Subject",className:"formcontrol"}))}}),y.dataCategory&&(0,r.jsx)("span",{style:{color:"red"},children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Title",children:"Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},b("title",{required:!0}))),y.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDesc",children:"Short Descr"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDesc",id:"shortDesc"},b("shortDesc",{required:!1})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},b("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var Bt=function(e){var t=e.openWithoutSubjModal,n=e.handleClose,s=e.isAddMode,l=(e.formdata,e.menuname),o=(e.entryformname,e.masterID),c=e.onSubmit,d=(e.watchFields,e.validate,e.form_title,e.rowId),u=e.menuDataType,m=e.menuDataCategory,f=e.acYear,h=e.grade,p=(0,Z.cI)(),x=p.register,b=p.handleSubmit,j=p.reset,g=(p.watch,p.setError,p.setValue),v=(p.control,p.clearErrors,p.formState.errors),N=(0,a.useState)({}),y=N[0],S=N[1];console.log("ac year:",f,"grade :",h),(0,a.useEffect)((function(){console.log("data item check",d),s||d&&Y(d).then((function(e){console.log("data after set",e),S(e),console.log("editdata after set",y)}
1))}),[]),(0,a.useEffect)((function(){["title","shortDesc","order"].forEach((function(e){return g(e,y[e])}))}),[y]);var C=(0,a.useState)({description:""});return C[0],C[1],(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(D.Z,{contentClassName:"sitedata-modal",show:t,onHide:n,backdrop:"static",className:"menuAddModal",children:[(0,r.jsx)(D.Z.Header,{closeButton:!0,children:(0,r.jsx)(D.Z.Title,{children:(0,r.jsx)("h2",{children:l})})}),(0,r.jsx)(D.Z.Body,{children:(0,r.jsxs)("form",{onSubmit:b((function(e){console.log("submitted data",e);var t=d;e.menuDataType=u,e.menuDataCategory=m,e.academicYear=f,e.grade=h,s&&(e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),z(e||[]).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):F.Am.success("Downloade Item Created"),j()}))),!s&&(console.log("data for edit",e),e.menuName=l,e.masterID=o,e.slug=(0,ye.Z)(e.title),J(e,t).then((function(e){e.error?(F.Am.error(e.error),console.log(e.error)):F.Am.success("Downloade Item Updated"),j()}))),c()})),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"Title",children:"Title"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"title",id:"title"},x("title",{required:!0}))),v.title&&(0,r.jsx)("span",{children:"This field is required"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"shortDesc",children:"Short Descr"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"text",name:"shortDesc",id:"shortDesc"},x("shortDesc",{required:!1})))]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"formlabel",htmlFor:"order",children:"Order"}),(0,r.jsx)("input",(0,i.Z)({className:"form-control",type:"Number",placeholder:"order"},x("order",{})))]})]}),(0,r.jsx)("br",{}),(0,r.jsx)("button",{className:"btn btn-primary",type:"submit",children:"Submit"}),(0,r.jsx)("button",{className:"btn btn-danger ml-5",type:"submit",onClick:function(){return n()},children:"Close"})]})}),(0,r.jsx)(D.Z.Footer,{className:"justify-content-between align-items-center"})]})})};var Et=function(){var e=function(){k(!1),T(!1),Q(!0);var e=d,t=re.label,n=le.label;xe(e,t,n),console.log("On Submit initiated and items downloaded")},t=(0,s.v9)((function(e){return e.selmenu.selitem})),n=t.menuName,l=t.dataFieldForm,o=t.entryFormTitle,d=t.masterID,u=t.hasImages,m=t.hasCroppedImages,f=t.hasLinks,h=t.hasFiles,p=t.cropWidth,x=t.cropHeight,b=t.menuDataType,j=t.menuDataCategory,g=(0,Z.cI)(),v=(g.register,g.handleSubmit),N=(g.reset,g.watch,g.setError,g.setValue,g.control),y=(g.clearErrors,g.formState.errors),S=(0,a.useState)([]),C=S[0],w=S[1],D=(0,a.useState)(!1),I=D[0],k=D[1],M=(0,a.useState)(!1),A=M[0],T=M[1],B=(0,a.useState)(!1),E=B[0],_=B[1],O=(0,a.useState)(!0),q=O[0],R=O[1],H=(0,a.useState)(""),P=H[0],G=H[1],L=(0,a.useState)(""),U=L[0],V=L[1],W=(0,a.useState)(!1),z=W[0],Q=W[1],Y=(0,a.useState)("img"),J=Y[0],ee=Y[1],te=(0,a.useState)(!1),ne=(te[0],te[1],(0,a.useState)("")),re=ne[0],ae=ne[1],se=(0,a.useState)(""),le=se[0],oe=se[1],ie=(0,a.useState)([]),ce=ie[0],de=ie[1],ue=(0,a.useState)([]),me=ue[0],fe=ue[1],he=((0,s.I0)(),(0,r.jsx)("i",{className:"mdi mdi-delete-forever"})),pe=(0,r.jsx)("i",{className:"mdi mdi-pencil-box"});(0,a.useEffect)((function(){if(""!==le&&void 0!==le&&null!==le&&""!==re&&void 0!==re&&null!==re){var e=d,t=re.label,n=le.label;xe(e,t,n)}}),[le,re]);var xe=function(e,t,n){w(""),K(e,t,n).then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e,t){return(0,c.Z)((0,i.Z)({},e),{slno:t+1})}));w(t),console.log("New download items site data received useeffect:",e)}}))};(0,a.useEffect)((function(){var e=d;_(!1),window.scrollTo(0,0),w(""),(0,Ve.BB)("academicyear").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));de(t),console.log("Data for Ac Year Items received in useeffect:",t)}})),(0,Ve.BB)("grade").then((function(e){if(e.error)console.log(e.error);else{var t=e.map((function(e){return{label:e.name,value:e._id}}));fe(t),console.log("Data for Grade Items received in useeffect:",e)}})),console.log("mid useeffect:",e)}),[t,z]);var be=function(e){Q(!1),R(!0),console.log("menu name in func",n),"Term Plans"===n||"Book List"===n?(T(!0),console.log("menu name in func in if condition",n)):k(!0),console.log("menu name in func",n)},je=function(){k(!1),T(!1)},ge=[{name:"Sl.No",selector:function(e){return e.slno},maxWidth:"80px",style:{textAlign:"center"}},{name:"Title",selector:function(e){return e.title}},{name:"Actions",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("button",{onClick:function(){return t=e._id,Q(!1),console.log("handle Edit",t),R(!1),G(t),void("Term Plans"===n||"Book List"===n?T(!0):k(!0));var t},className:"btn btn-inverse-info py-1 px-2 me-2",children:pe}),(0,r.jsx)("button",{onClick:function(){return t=e._id,Q(!1),console.log("Sending from multiDataComp to delete:",t),void X(t).then((function(e){console.log("DataAddItem saved response",e),Q(!0);var t=d,n=re.label,r=le.label;xe(t,n,r)}));var t},className:"btn btn-inverse-danger py-1 px-2 me-5",children:he}),(u||m)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){G(e),V(t),_(!0),ee("img"),console.log("handle Images",t)}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Images"]}),(h||f)&&(0,r.jsxs)("button",{onClick:function(){return function(e,t){G(e),V(t),_(!0),ee("pdf"),console.log("handle Files",t)}(e._id,e.title)},className:"btn btn-outline-success btn-sm me-2",children:[(0,r.jsx)("i",{className:"mdi mdi-plus-box"})," Files"]})]})})},ignoreRowClick:!0,allowOverflow:!0,button:!1,minWidth:"300px"},{name:"Active",cell:function(e){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"form-check form-switch form-check-inline",children:(0,r.jsx)("input",{className:"form-check-input",type:"checkbox",role:"switch",id:"Switch",defaultChecked:e.isActive,onChange:function(t){return function(e,t){e.preventDefault(),$(t).then((function(e){if(e.error)F.Am.error(e.error),console.log(e.error);else{F.Am.success("Is Active Updated");var t=d,n=re.label,r=le.label;xe(t,n,r)}}))}(t,e._id)}})})})}}];return console.log("ac year:",re,"grade :",le),console.log("openWithoutSubjModal :",A),(0,r.jsx)(r.Fragment,{children:E?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("h3",{className:"page-title",children:[n," / ",U]}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsxs)("li",{className:"breadcrumb-item active","aria-current":"page",children:[n," / ",U]})]})})]}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("h4",{className:"card-title",children:[n," / ",U," - Images List"]}),(0,r.jsx)("div",{className:"",children:(0,r.jsx)(Ne,{handleClose:function(){_(!1)},imageComp:E,onSubmit:e,menuname:n,masterID:d,dataID:P,fileModelRef:"SiteData",dataTitle:U,hasLinks:f,hasImages:u,hasFiles:h,hasCroppedImages:m,fileGroup:J,cropWidth:p,cropHeight:x})})]})})})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h3",{className:"page-title",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})}),(0,r.jsx)("nav",{"aria-label":"breadcrumb",children:(0,r.jsxs)("ol",{className:"breadcrumb",children:[(0,r.jsx)("li",{className:"breadcrumb-item",children:(0,r.jsx)("a",{href:"!#",onClick:function(e){return e.preventDefault()},children:"Home"})}),(0,r.jsx)("li",{className:"breadcrumb-item active","aria-current":"page",children:o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})})]})})]}),(0,r.jsx)("form",{onSubmit:v((function(e){console.log("data in handle form",e);var t=e.academicYear,n=e.grade;!function(e,t,n){console.log("check data after form submit",e,t,n),""===t||void 0===t||""===n||void 0===n?alert("Select Academic Year and Grade"):xe(e,t,n)}(d,t,n)})),children:(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"col-md-4 p-0",children:(0,r.jsx)(Z.Qr,{name:"academicYear",control:N,defaultValue:"",rules:{required:!1},styles:{border:y.deptBodyRole,"1px solid red":""},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:ce,onChange:function(e){t.onChange(e),function(e){ae(""),ae(e),console.log("value in handle AcYear Change",e)}(e)},placeholder:"Select Academic Year",className:"formcontrol"}))}})}),(0,r.jsx)("div",{className:"col-md-4 p-0",children:(0,r.jsx)(Z.Qr,{name:"grade",control:N,defaultValue:"",rules:{required:!1},styles:{border:y.deptBodyRole,"1px solid red":""},render:function(e){var t=e.field;return(0,r.jsx)(Ge.ZP,(0,c.Z)((0,i.Z)({},t),{options:me,onChange:function(e){t.onChange(e),function(e){oe(""),oe(e)}(e)},placeholder:"Select Grade",className:"formcontrol"}))}})})]})})})}),(0,r.jsx)("div",{className:"row",children:(0,r.jsx)("div",{className:"col-lg-12 grid-margin stretch-card",children:(0,r.jsx)("div",{className:"card",children:(0,r.jsxs)("div",{className:"card-body",children:[(0,r.jsxs)("button",{type:"button",className:"btn btn-sm btn-success btn-fw float-end",onClick:function(){""===re||""===le?alert("Select Academic Year and Grade befor adding new item"):be()},children:[(0,r.jsx)("i",{className:"mdi mdi-plus-circle"})," Add New ",n]}),(0,r.jsxs)("h4",{className:"card-title",children:["Manage"," ",o?(0,r.jsx)(r.Fragment,{children:o}):(0,r.jsx)(r.Fragment,{children:n})]}),(0,r.jsx)("div",{className:"table-responsive",children:(0,r.jsx)(Fe.ZP,{data:C,columns:ge,pagination:!0}
1)})]})})})}),(0,r.jsxs)("div",{children:[I?(0,r.jsx)(Tt,{handleClose:je,openModal:I,isAddMode:q,form_title:o,menuname:n,menuDataType:b,menuDataCategory:j,masterID:d,entryformname:l.label,rowId:P,onSubmit:e,acYear:re,grade:le,placeholder:"Description"}):null,";",(0,r.jsx)("div",{}),A?(0,r.jsx)(Bt,{handleClose:je,openWithoutSubjModal:A,isAddMode:q,form_title:o,menuname:n,menuDataType:b,menuDataCategory:j,masterID:d,entryformname:l.label,rowId:P,onSubmit:e,acYear:re,grade:le,placeholder:"Description"}):null,";"]})]})})};var _t=function(){(0,s.v9)((function(e){return e.menu.items}));var e=(0,s.v9)((function(e){return e.selmenu.selitem})),t=e.menuName,n=(e.hasSubMenu,e.formCategory,e.customForm,e.isAddOfficialMenu),a=e.deptBody;return console.log("Menu Name :",t),(0,r.jsx)("div",{children:"Users"===t?(0,r.jsx)(gt,{}):"Dept./Body"===t?(0,r.jsx)(Ft,{}):"Dept.Body Roles"===t?(0,r.jsx)(kt,{}):"Term Plans"===t||"CBSE Question Papers"===t||"Book List"===t||"Work Sheets"===t?(0,r.jsx)(Et,{}):!0===n?(0,r.jsx)(At,{deptBody:a}):void 0})},Ot=(function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t),n=JSON.stringify(t),e.prev=2,e.next=5,M().post(g.bl+"/subMenuGroup",n,{headers:{"Content-type":"application/json"}});case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),e.t0;case 10:case"end":return e.stop()}}),e,null,[[2,7]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data in axios",t,n),r=JSON.stringify(t),console.log("data in axios after stringify",r,n),e.prev=3,e.next=6,M().put(g.bl+"/subMenuGroup/".concat(n),r,{headers:{"Content-type":"application/json"}},console.log("data sent from axios",r));case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),e.t0;case 11:case"end":return e.stop()}}),e,null,[[3,8]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(){var t;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/entryFormFields");case 3:return t=e.sent.data,e.abrupt("return",t);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()),qt=(function(){var e=(0,h.Z)(x().mark((function e(t,n){var r;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().post(g.bl+"/dataFiles",{dataID:t,fileGroup:n});case 3:return r=e.sent.data,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().get(g.bl+"/subMenuGroup/".concat(t));case 3:return n=e.sent.data,console.log("received data",n),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))}(),function(){var e=(0,h.Z)(x().mark((function e(t){var n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M().delete(g.bl+"/subMenuGroup/".concat(t));case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),e.t0;case 11:case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))}(),a.forwardRef((function(e,t){var n=e.onClick,a=(0,d.Z)(e,["onClick"]);return(0,r.jsxs)("div",{className:"form-check",children:[(0,r.jsx)("input",(0,i.Z)({htmlFor:"booty-check",type:"checkbox",className:"form-check-input",ref:t,onClick:n},a)),(0,r.jsx)("label",{className:"form-check-label",id:"booty-check"})]})})));qt.displayName="BootyCheckbox";var Rt=n(52641);var Ht=function(){var e=(0,a.useState)(),t=e[0],n=(e[1],(0,a.useState)(!1)),s=(n[0],n[1]),l=(0,a.useState)([]),o=l[0],i=l[1],c=(0,a.useState)([{id:"",fieldName:"",fieldType:"",fieldLabel:"",fieldRequired:!1}]);return c[0],c[1],(0,a.useEffect)((function(){Ot().then((function(e){e.error?console.log(e.error):(i(e),console.log("site data received useeffect:",e))}))}),[]),(0,r.jsxs)("div",{className:"App",children:[(0,r.jsxs)("table",{className:"table formtable table-striped table-bordered table-sm ",children:[(0,r.jsx)("div",{children:(0,r.jsx)("th",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{width:"10%"},children:"Sel.Row"}),(0,r.jsx)("td",{style:{width:"210px"},children:"Form Field"}),(0,r.jsx)("td",{style:{width:"212px"},children:"Form Label"}),(0,r.jsx)("td",{style:{width:"125px"},children:"Required"})]})})}),o.map((function(e,t){return(0,r.jsx)("div",{className:"",children:(0,r.jsx)(Rt.Z,{className:"tableform",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:{width:"10%"},children:(0,r.jsx)("input",{className:"form-chkbox",type:"checkbox",defaultChecked:e.fieldRequired,onChange:"",onBlur:function(e){return e.target.value}})}),(0,r.jsx)("td",{style:{width:"35%"},children:(0,r.jsx)("input",{type:"text",className:"form-control",name:"fieldName",id:"fieldName",placeholder:e.fieldName,onChange:"",value:e.fieldName})}),(0,r.jsx)("td",{style:{width:"35%"},children:(0,r.jsx)("input",{type:"text",className:"form-control",name:"fieldLabel",id:"fieldLabel",placeholder:"Label",onCh
1ange:"",value:e.fieldLabel})}),(0,r.jsxs)("td",{children:[(0,r.jsx)("input",{className:"form-chkbox",type:"checkbox",defaultChecked:e.fieldRequired,onChange:"",placeholder:"Has Submenu",onBlur:function(e){return e.target.value}}),(0,r.jsx)("input",{type:"hidden",name:"id",id:"fieldId",onChange:"",value:e._id}),(0,r.jsx)("input",{type:"hidden",className:"form-control",name:"fieldType",id:"fieldType",onChange:"",value:e.fieldType})]})]})})},"".concat(e.fieldName).concat(t))}))]}),(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"btn info",onClick:function(){s(!0),console.log(t)},children:"Show Data"})})]})},Pt=function(){var e=(0,s.I0)(),t=(0,s.v9)((function(e){return e.menu.items})),n=(0,s.v9)((function(e){return e.selmenu.selitem})),i=(n.menuName,n.hasSubMenu,n.formCategory),c=(n.customForm,i.value);return(0,a.useEffect)((function(){e(P())}),[e]),(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(F.Ix,{closeButton:!1,position:"top-right"}),(0,r.jsxs)("div",{className:"container-scroller",style:{height:"100vh",overflow:"hidden"},children:[(0,r.jsx)(l.Z,{}),(0,r.jsxs)("div",{className:"container-fluid page-body-wrapper px-0",children:[(0,r.jsx)(U,{newmenus:t}),(0,r.jsx)("div",{className:"main-panel pb-5",style:{height:"100vh",overflow:"auto"},children:(0,r.jsx)("div",{className:"content-wrapper",children:"MultipleItems"===c?(0,r.jsx)(qe,{}):"ManageMenu"===c?(0,r.jsx)(Qe,{}):"SubMenuGroup"===c?(0,r.jsx)($e,{}):"EntryForms"===c?(0,r.jsx)(Ht,{}):"SingleItem"===c?(0,r.jsx)(Ie,{}):"MultipleCustomMasters"===c?(0,r.jsx)(et,{}):"MultipleCustomData"===c?(0,r.jsx)(it,{}):"EventMultiDataComp"===c?(0,r.jsx)(ut,{}):"CustomForms"===c?(0,r.jsx)(_t,{}):(0,r.jsx)(Re.Z,{})})})]})]})]})}},65893:function(e){e.exports={managemenucontent:"ManageMenu_managemenucontent__17o2_"}},65494:function(){}},function(e){e.O(0,[4885,8523,5212,8764,1217,2533,3132,5808,3134,6396,7004,9774,2888,179],(function(){return t=33563,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.