1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2212],{50308:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/[facultyId]/management-team/aptitudes",function(){return n(52561)}])},14384:function(e,t,n){"use strict";n.d(t,{Q:function(){return d}});var r=n(11527),i=n(64482),a=n(20115),o=n(55833),c=n(71762),u=n(34124),l=n(38062),s=n(50959);let d=e=>{let{isOpen:t,title:n,detail:d,onCancel:f,onConfirm:h,actionLabel:p,cancelLabel:x,isDestructive:m=!0}=e,v=(0,s.useRef)(null);return(0,r.jsx)(i.a,{isOpen:t,leastDestructiveRef:v,onClose:f,children:(0,r.jsx)(a.Z,{children:(0,r.jsxs)(i._,{margin:0,top:"40%",borderRadius:"12px",children:[(0,r.jsx)(o.x,{fontSize:"22px",fontWeight:"700",color:"#2D3748",pt:"24px",px:"24px",pb:"0",children:n}),(0,r.jsx)(c.f,{fontSize:"20px",color:"#919191",px:"24px",children:d}),(0,r.jsxs)(u.m,{px:"24px",pb:"24px",children:[(0,r.jsx)(l.z,{ref:v,onClick:f,bgColor:"#EDF2F7",color:"#2D3748",h:"35px",px:"18px",minW:"100px",borderRadius:"8px",fontSize:"16px",fontWeight:"700",_hover:{bg:"#E2E8F0"},children:x}),(0,r.jsx)(l.z,{onClick:h,ml:3,bgColor:m?"#EF3C63":"#74C7FB",color:"white",h:"35px",px:"18px",minW:"100px",borderRadius:"8px",fontSize:"16px",fontWeight:"700",_hover:{bg:m?"#D6335A":"#4299E1"},children:p})]})]})})})}},17338:function(e,t,n){"use strict";n.d(t,{C9:function(){return l},N5:function(){return o},PH:function(){return r},dB:function(){return c},nz:function(){return a},ri:function(){return u},yU:function(){return i}});let r=e=>"th"==e?"à¸à¸§à¸²à¸¡à¸à¸à¸±à¸":"Proficiency",i=e=>"th"==e?"สรà¹à¸²à¸à¸à¸§à¸²à¸¡à¸à¸à¸±à¸":"New aptitude",a=e=>"th"==e?"à¸à¸·à¹à¸à¸à¸§à¸²à¸¡à¸à¸à¸±à¸":"Aptitude name",o=e=>"th"==e?"à¸à¸·à¹à¸à¸à¸§à¸²à¸¡à¸à¸à¸±à¸ (TH)":"Aptitude Name (TH)",c=e=>"th"==e?"à¸à¸·à¹à¸à¸à¸§à¸²à¸¡à¸à¸à¸±à¸ (EN)":"Aptitude Name (EN)",u=e=>"th"==e?"à¸à¸±à¸à¸à¸¶à¸":"Save",l=e=>"th"==e?"ยà¸à¹à¸¥à¸´à¸":"Discard"},52561:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Z}});var r=n(11527),i=n(3658),a=n(37471),o=n(38062),c=n(91220),u=n(89498),l=n(70115),s=n(64018),d=n(29957),f=n(63477),h=n(78046),p=n(20549),x=n(12666),m=n(50959),v=n(49350),g=n(1625),y=n(96427),E=n(17338),j=n(14384),S=n(62011),b=n(38575),C=n(73257),_=n(65939),w=n(78705),k=n(55204),N=n(40314),A=n(8325),T=n(65477);let R=(e,t)=>[{label:(0,E.nz)(e),value:"nameTH",showSort:!1,onClickSort:t,minWidth:"300px"}],I=e=>{let{aptitude:t,lang:n,onChangeOrder:i}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(A.Td,{children:(0,r.jsx)(u.k,{alignItems:"center",children:(0,r.jsx)(T.x,{ml:1,children:"en"==n?t.nameEN:t.nameTH})})})})};var F=n(50128),P=n(40439),W=n(97162),z=n(61202),D=n(68764),M=n(58825),Z=()=>{var e,t,n;let A=(0,y.b)(),T=(0,D.S)(),Z=null==T?void 0:null===(e=T.userState)||void 0===e?void 0:e.permissions,O=(null==Z?void 0:Z.find(e=>"MANAGEMENT_APTITUDE_EDIT"==e))!=void 0,H=(null==Z?void 0:Z.find(e=>"MANAGEMENT_APTITUDE_VIEW"==e))!=void 0,L=null!==(n=null==A?void 0:null===(t=A.appState)||void 0===t?void 0:t.language)&&void 0!==n?n:"",B=(0,g.useRouter)(),{query:V}=B,{facultyId:G}=B.query,U=(0,i.p)(),[q,X]=(0,m.useState)([]),[$,J]=(0,m.useState)(0),[Q,Y]=(0,m.useState)(0),[K,ee]=(0,m.useState)(0),[et,en]=(0,m.useState)(F.nV[0]),[er,ei]=(0,m.useState)(!0),[ea,eo]=(0,m.useState)(null),[ec,eu]=(0,m.useState)(V.search?V.search.toString():""),el=async e=>{if(void 0==G)return;let t=(0,P.Fi)(e,et);try{ei(!0);let e=V.search?V.search.toString():void 0,n=await (0,W.ec)({skip:t,limit:et,search:e});n&&(X(n.aptitudes),J(n.total),Y((0,P.DR)(n.total,et)),ee((0,P.u)(t,et)),ei(!1))}catch(e){(0,C.ck)(U)}},es=async e=>{try{await (0,W.Vv)(e),X(q.filter(e=>e.id!=ea)),(0,C.XA)(U)}catch(e){(0,C.ck)(U)}eo(null)};(0,m.useEffect)(()=>{el(K)},[G,K]),(0,m.useEffect)(()=>{el(0)},[V]),(0,m.useEffect)(()=>{el(0)},[et]);let ed=(0,M.y1)(()=>{B.push({query:{...V,search:ec}})},1e3);return(0,m.useEffect)(()=>{ed()},[ec]),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(p.Z,{title:(0,E.PH)(L),currentLink:z.cy,breadcrumbs:z.cy.breadcrumbs,topBarChilren:(0,r.jsxs)(a.U,{mx:10,children:[(0,r.jsx)(o.z,{color:"white",bgColor:"#74C7FB",_hover:{bg:"#4299E1"},h:"35px",px:"18px",py:"5px",minW:"100px",borderRadius:"8px",fontSize:"16px",fontWeight:"700",disabled:!O,onClick:()=>{B.push({pathname:"/admin/[facultyId]/management-team/aptitudes/create",query:{facultyId:G}})},children:(0,E.yU)(L)}),(0,r.jsx)(c.L,{})]}),children:H&&(0,r.jsxs)(x.t,{fullWidth:!0,children:[(0,r.jsx)(j.Q,{isOpen:null!=ea,title:(0,b.WL)(L),detail:(0,b.NJ)(L),actionLabel:(0,b.WW)(L),cancelLabel:(0,b.yj)(L),onCancel:()=>{eo(null)},onConfirm:async()=>{ea&&es(ea)}}),(0,r.jsx)(S.Z,{children:(0,r.jsxs)(v.Z,{w:"100%",overflow:"hidden",children:[(0,r.jsxs)(u.k,{width:"100%",justifyContent:"space-between",alignItems:"center",marginBottom:"42.5px",children:[(0,r.jsx)(l.X,{as:"h2",fontSize:"24px",fontWeight:"700",children:(0,E.PH)(L)}),(0,r.jsx)(s.xu,{w:"200px",h:"40px",children:(0,r.jsxs)(d.B,{children:[(0,r.jsx)(f.Z,{pointerEvents:"none",children:(0,r.jsx)(_.W,{color:"#2D3748"})}),(0,r.jsx)(h.I,{type:"text",borderColor:"#E2E8F0",focusBorderColor:"#E2E8F0",_hover:{borderColor:"#E2E8F0"},value:ec,borderRadius:"8px",placeholder:(0,w.VU)(L),_placeholder:{color:"#A0AEC0",fontFamily:"RSU",fontWeight:"700",fontSize:"16px"},onChange:e=>{e&&eu(e.currentTarget.value)}})]})})]}),(0,r.jsx)(k.g,{lang:L,headers:R(L,e=>{console.log("click sort",e)}),data:q,rowRenderer:e=>(0,r.jsx)(I,{aptitude:e,lang:L,onChangeOrder:(e,t)=>{}},e.id),canView:H,canEdit:O,hasViewAction:H&&!O,hasAction:H||O,onClickViewAction:e=>{B.push({pathname:"/admin/[facultyId]/management-team/aptitudes/[cid]",query:{facultyId:G,cid:e}})},onClickEditAction:e=>{let t="/admin/".concat(G,"/management-team/aptitudes/").concat(e);Object.assign(document.createElement("a"),{target:"_blank",rel:"noopener noreferrer",href:t}).click()},hasCopyLinkAction:!1,hasDuplicateAction:!1,onClickDeleteAction:e=>{eo(e)}},L),(0,r.jsx)(N.Z,{totalItems:$,totalPage:Q,itemPerPage:et,onChangeItemPerPage:e=>{en(e)},currentPage:K,onChangeCurrentPage:e=>{ee(e)}})]})})]})})})}},97162:function(e,t,n){"use strict";n.d(t,{HH:function(){return o},Vv:function(){return s},ec:function(){return u},ov:function(){return l},zm:function(){return c}});var r=n(50128),i=n(58928),a=n(63885);let o=async e=>{var t;let n=(null===(t=(0,i.getCookie)(r.ml))||void 0===t?void 0:t.toString())||"";return await (0,a._i)("/api/v2/management-aptitudes",{method:"POST",cac
1he:"no-cache",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(e)})},c=async e=>{var t;let n=(null===(t=(0,i.getCookie)(r.ml))||void 0===t?void 0:t.toString())||"";return await (0,a._i)("/api/v2/management-aptitudes/".concat(e,"?is-admin=true"),{method:"GET",cache:"no-cache",headers:{"Content-Type":"application/json",Authorization:n}})},u=async e=>{var t;let n=(null===(t=(0,i.getCookie)(r.ml))||void 0===t?void 0:t.toString())||"",o="/api/v2/management-aptitudes"+"?is-admin=true&skip=".concat(e.skip,"&limit=").concat(e.limit);return e.search&&(o+="&search=".concat(e.search)),void 0!=e.hasOrder&&(o+="&has-order=".concat(e.hasOrder)),await (0,a._i)(o,{method:"GET",cache:"no-cache",headers:{"Content-Type":"application/json",Authorization:n}})},l=async e=>{var t;let n=(null===(t=(0,i.getCookie)(r.ml))||void 0===t?void 0:t.toString())||"",o="/api/v2/management-aptitudes/".concat(e.id);await (0,a._i)(o,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(e)})},s=async e=>{var t;let n=(null===(t=(0,i.getCookie)(r.ml))||void 0===t?void 0:t.toString())||"";await (0,a._i)("/api/v2/management-aptitudes/".concat(e),{method:"DELETE",cache:"no-cache",headers:{"Content-Type":"application/json",Authorization:n}})}},62011:function(e,t,n){"use strict";var r=n(11527),i=n(87828);t.Z=e=>{let{children:t,...n}=e;return(0,r.jsx)(i.Z,{borderRadius:"20px",...n,children:t})}},87828:function(e,t,n){"use strict";var r=n(11527);n(50959);var i=n(89498);t.Z=e=>{let{children:t,...n}=e;return(0,r.jsx)(i.k,{boxShadow:"0px 0px 8px rgba(0, 0, 0, 0.08)",mx:6,mt:6,bgColor:"white",direction:"column",borderRadius:8,...n,children:t})}},49350:function(e,t,n){"use strict";var r=n(11527);n(50959);var i=n(89498);t.Z=e=>{let{children:t,...n}=e;return(0,r.jsx)(i.k,{pt:6,px:{base:"12px",md:6},mb:4,direction:"column",alignItems:"center",alignContent:"center",alignSelf:"center",...n,children:t})}},15293:function(e,t,n){e.exports=n(35783)},58825:function(e,t,n){"use strict";n.d(t,{y1:function(){return i}});var r=n(50959);function i(e,t,n){var i=this,a=(0,r.useRef)(null),o=(0,r.useRef)(0),c=(0,r.useRef)(null),u=(0,r.useRef)([]),l=(0,r.useRef)(),s=(0,r.useRef)(),d=(0,r.useRef)(e),f=(0,r.useRef)(!0);(0,r.useEffect)(function(){d.current=e},[e]);var h=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,x=!("trailing"in n)||!!n.trailing,m="maxWait"in n,v=m?Math.max(+n.maxWait||0,t):null;return(0,r.useEffect)(function(){return f.current=!0,function(){f.current=!1}},[]),(0,r.useMemo)(function(){var e=function(e){var t=u.current,n=l.current;return u.current=l.current=null,o.current=e,s.current=d.current.apply(n,t)},n=function(e,t){h&&cancelAnimationFrame(c.current),c.current=h?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!f.current)return!1;var n=e-a.current;return!a.current||n>=t||n<0||m&&e-o.current>=v},g=function(t){return c.current=null,x&&u.current?e(t):(u.current=l.current=null,s.current)},y=function e(){var i=Date.now();if(r(i))return g(i);if(f.current){var c=t-(i-a.current);n(e,m?Math.min(c,v-(i-o.current)):c)}},E=function(){var d=Date.now(),h=r(d);if(u.current=[].slice.call(arguments),l.current=i,a.current=d,h){if(!c.current&&f.current)return o.current=a.current,n(y,t),p?e(a.current):s.current;if(m)return n(y,t),e(a.current)}return c.current||n(y,t),s.current};return E.cancel=function(){c.current&&(h?cancelAnimationFrame(c.current):clearTimeout(c.current)),o.current=0,u.current=a.current=l.current=c.current=null},E.isPending=function(){return!!c.current},E.flush=function(){return c.current?g(Date.now()):s.current},E},[p,m,t,v,x,h])}},79869:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,{Z:function(){return r}})},65939:function(e,t,n){"use strict";n.d(t,{W:function(){return r}});var r=(0,n(59797).I)({d:"M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z",displayName:"SearchIcon"})},91220:function(e,t,n){"use strict";n.d(t,{L:function(){return r}});var r=(0,n(78379).m)("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});r.displayName="Spacer"},70115:function(e,t,n){"use strict";n.d(t,{X:function(){return l}});var r=n(52795),i=n(49226),a=n(5179),o=n(78379),c=n(6551),u=n(11527),l=(0,r.G)(function(e,t){let n=(0,i.mq)("Heading",e),{className:r,...l}=(0,a.Lr)(e);
1return(0,u.jsx)(o.m.h2,{ref:t,className:(0,c.cx)("chakra-heading",e.className),...l,__css:n})});l.displayName="Heading"},25372:function(e,t,n){"use strict";n.d(t,{h:function(){return g}});var r=n(78379),i=n(97130),a=n(6551),o=n(98771),c=n(63704),u=n(50959),l=n(11527),s={initial:"initial",animate:"enter",exit:"exit",variants:{initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:a})=>{var o;return{opacity:0,x:e,y:t,transition:null!=(o=null==n?void 0:n.exit)?o:i.p$.exit(i.Sh.exit,a),transitionEnd:null==r?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:null!=(r=null==e?void 0:e.enter)?r:i.p$.enter(i.Sh.enter,n),transitionEnd:null==t?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:a,delay:o})=>{var c;let u={x:t,y:e};return{opacity:0,transition:null!=(c=null==n?void 0:n.exit)?c:i.p$.exit(i.Sh.exit,o),...a?{...u,transitionEnd:null==r?void 0:r.exit}:{transitionEnd:{...u,...null==r?void 0:r.exit}}}}}};(0,u.forwardRef)(function(e,t){let{unmountOnExit:n,in:r,reverse:i=!0,className:u,offsetX:d=0,offsetY:f=8,transition:h,transitionEnd:p,delay:x,...m}=e,v=!n||r&&n,g=r||n?"enter":"exit",y={offsetX:d,offsetY:f,reverse:i,transition:h,transitionEnd:p,delay:x};return(0,l.jsx)(o.M,{custom:y,children:v&&(0,l.jsx)(c.E.div,{ref:t,className:(0,a.cx)("chakra-offset-slide",u),custom:y,...s,animate:g,...m})})}).displayName="SlideFade";var d={initial:"exit",animate:"enter",exit:"exit",variants:{exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:a})=>{var o;return{opacity:0,...e?{scale:t,transitionEnd:null==r?void 0:r.exit}:{transitionEnd:{scale:t,...null==r?void 0:r.exit}},transition:null!=(o=null==n?void 0:n.exit)?o:i.p$.exit(i.Sh.exit,a)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:null!=(r=null==t?void 0:t.enter)?r:i.p$.enter(i.Sh.enter,n),transitionEnd:null==e?void 0:e.enter}}}};(0,u.forwardRef)(function(e,t){let{unmountOnExit:n,in:r,reverse:i=!0,initialScale:u=.95,className:s,transition:f,transitionEnd:h,delay:p,...x}=e,m=!n||r&&n,v=r||n?"enter":"exit",g={initialScale:u,reverse:i,transition:f,transitionEnd:h,delay:p};return(0,l.jsx)(o.M,{custom:g,children:m&&(0,l.jsx)(c.E.div,{ref:t,className:(0,a.cx)("chakra-offset-slide",s),...d,animate:v,custom:g,...x})})}).displayName="ScaleFade";var f={slideInBottom:{...s,custom:{offsetY:16,reverse:!0}},slideInRight:{...s,custom:{offsetX:16,reverse:!0}},scale:{...d,custom:{initialScale:.95,reverse:!0}},none:{}},h=(0,r.m)(c.E.section),p=e=>f[e||"none"],x=(0,u.forwardRef)((e,t)=>{let{preset:n,motionProps:r=p(n),...i}=e;return(0,l.jsx)(h,{ref:t,...r,...i})});x.displayName="ModalTransition";var m=n(48317),v=n(66800),g=(0,n(52795).G)((e,t)=>{let{className:n,children:i,containerProps:o,motionProps:c,...u}=e,{getDialogProps:s,getDialogContainerProps:d}=(0,v.vR)(),f=s(u,t),h=d(o),p=(0,a.cx)("chakra-modal__content",n),g=(0,v.I_)(),y={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},E={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:j}=(0,v.vR)();return(0,l.jsx)(m.M,{children:(0,l.jsx)(r.m.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:E,children:(0,l.jsx)(x,{preset:j,motionProps:c,className:p,...f,__css:y,children:i})})})});g.displayName="ModalContent"},64482:function(e,t,n){"use strict";n.d(t,{_:function(){return u},a:function(){return c}});var r=n(25372),i=n(66800),a=n(52795),o=n(11527);function c(e){let{leastDestructiveRef:t,...n}=e;return(0,o.jsx)(i.u_,{...n,initialFocusRef:t})}var u=(0,a.G)((e,t)=>(0,o.jsx)(r.h,{ref:t,role:"alertdialog",...e}))}},function(e){e.O(0,[8952,3053,2440,9213,4801,7999,5093,9260,1202,8499,5534,2888,9774,179],function(){return e(e.s=50308)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.