1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[18156],{84535:function(e,t,a){a.d(t,{V:function(){return P}});var s=a(57437),l=a(42264),n=a(3810),i=a(63709),d=a(89970),r=a(21770),c=a(43949),o=a(35631),u=a(93142),m=a(91652),h=a(2265),f=a(71134),x=a(22116),g=a(30166),b=a(44967),v=a(867),j=a(78871),p=a(16836),y=a(71096),T=a.n(y),Z=a(79373),w=a(5945),N=a(47451),k=a(69410),S=a(71632),D=a(15981),C=a(66718);let P=e=>{let{objectives:t,taskId:a,refetchAssignment:d,isDisabled:u,canEdit:m=!1}=e,{t:h}=(0,c.$G)("common"),{mutate:f}=(0,r.useMutation)({mutationFn:async e=>{let{updatedObjectives:t}=e;try{await (0,D.s2)(a,t),l.ZP.success(h("assignmentDetails.objectiveStatusUpdated",{defaultValue:"Objective status updated"})),d()}catch(e){l.ZP.error(h("assignmentDetails.objectiveStatusFailed",{defaultValue:"Failed to update objective status"})),console.error(e)}}}),x=e=>{let a=[...t];a[e].achieved=!a[e].achieved,f({updatedObjectives:a})};return(0,s.jsx)(o.Z,{header:(0,s.jsx)("div",{children:h("assignmentDetails.objectives",{defaultValue:"Objectives"})}),bordered:!0,dataSource:t,renderItem:(e,t)=>(0,s.jsxs)(o.Z.Item,{children:[(0,s.jsxs)("div",{style:{flex:1,display:"flex"},children:[e.title,(0,s.jsx)(n.Z,{className:"ml-auto",color:e.achieved?"green":"volcano",children:e.achieved?h("assignmentDetails.achieved",{defaultValue:"Achieved"}):h("assignmentDetails.notAchieved",{defaultValue:"Not Achieved"})})]}),(0,s.jsx)(i.Z,{checked:e.achieved,onChange:()=>x(t),disabled:u})]})})},F=e=>{let{assignees:t}=e,{t:a}=(0,c.$G)("common");return(0,s.jsx)(o.Z,{header:(0,s.jsx)("div",{children:a("assignmentDetails.assignees",{defaultValue:"Assignees"})}),bordered:!0,dataSource:t,renderItem:e=>(0,s.jsx)(o.Z.Item,{children:(0,s.jsxs)(u.Z,{children:[(0,s.jsx)(m.Z,{src:e.avatar||"/avatar_holder.png"}),e.firstName," ",e.lastName]})})})},I=(0,g.default)(()=>Promise.all([a.e(29041),a.e(22177),a.e(89981)]).then(a.bind(a,85421)),{loadableGenerated:{webpack:()=>[85421]},ssr:!1}),V=e=>{let{notes:t,taskId:a,refetchAssignment:n,isDisabled:i}=e,{t:d}=(0,c.$G)("common"),[u,m]=(0,h.useState)(!1),[g,b]=(0,h.useState)(null),[v,j]=(0,h.useState)(""),{mutate:p}=(0,r.useMutation)({mutationFn:async e=>{let{content:t}=e;g?await (0,D.Qk)(a,g._id,t):await (0,D.By)(a,t)},onSuccess:()=>{l.ZP.success(d("assignmentDetails.noteSaved",{defaultValue:"Note saved"})),m(!1),b(null),j(""),n()},onError:()=>{l.ZP.error(d("assignmentDetails.noteSaveFailed",{defaultValue:"Failed to save note"}))}}),y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;b(e),j(e?e.content:""),m(!0)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Z,{header:(0,s.jsx)("div",{children:d("assignmentDetails.notes",{defaultValue:"Notes"})}),bordered:!0,dataSource:t,renderItem:e=>(0,s.jsx)(o.Z.Item,{actions:[(0,s.jsx)(f.ZP,{onClick:()=>y(e),disabled:i,children:d("assignmentDetails.edit",{defaultValue:"Edit"})})],children:(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:e.content}})})}),(0,s.jsx)(f.ZP,{type:"primary",onClick:()=>y(),style:{marginTop:"10px"},disabled:i,children:d("assignmentDetails.addNote",{defaultValue:"Add Note"})}),(0,s.jsx)(x.default,{title:g?d("assignmentDetails.editNote",{defaultValue:"Edit Note"}):d("assignmentDetails.addNote",{defaultValue:"Add Note"}),visible:u,onCancel:()=>{m(!1),b(null),j("")},onOk:()=>p({content:v}),okButtonProps:{disabled:i},children:(0,s.jsx)(I,{data:v,onChange:(e,t)=>
1{j(t.getData())}})})]})},$=e=>{let{taskId:t,isDisabled:a}=e,{t:n}=(0,c.$G)("common"),[i,d]=(0,h.useState)(!1),[m,g]=(0,h.useState)(null),[y]=b.Z.useForm(),{data:Z,refetch:w}=(0,S.useQuery)({queryKey:["time-logs",t],queryFn:async()=>{try{var e;let a=await C.Z.search("TimeLog",100,1,{filters:{task:t},sort:{createdAt:-1}});return null==a?void 0:null===(e=a.data)||void 0===e?void 0:e.items}catch(e){return console.error(e),[]}}}),{mutate:N}=(0,r.useMutation)({mutationFn:async e=>{let{logData:a}=e;m?await (0,D.he)(m._id,a.startTime,a.endTime,a.comments):await (0,D.VS)(t,a.startTime,a.endTime,a.comments)},onSuccess:()=>{l.ZP.success(n("assignmentDetails.timeLogSaved",{defaultValue:"Time log saved"})),d(!1),g(null),w()},onError:()=>{l.ZP.error(n("assignmentDetails.timeLogSaveFailed",{defaultValue:"Failed to save time log"}))}}),{mutate:k}=(0,r.useMutation)({mutationFn:async e=>{await (0,D.GI)(e)},onSuccess:()=>{l.ZP.success(n("assignmentDetails.timeLogDeleted",{defaultValue:"Time log deleted"})),w()},onError:()=>{l.ZP.error(n("assignmentDetails.timeLogDeleteFailed",{defaultValue:"Failed to delete time log"}))}}),P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;g(e),d(!0),y.setFieldsValue({...e,startTime:e?T()(e.startTime):null,endTime:e?T()(e.endTime):null,comments:(null==e?void 0:e.comments)||""})},F=(e,t)=>{t&&T()(t).isValid()?y.setFieldsValue({[e]:t}):y.setFieldsValue({[e]:null})},I=null==Z?void 0:Z.reduce((e,t)=>e+T()(t.endTime).diff(T()(t.startTime),"hour",!0),0);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Z,{header:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("p",{children:n("assignmentDetails.timeLogs",{defaultValue:"Time Logs"})}),(0,s.jsx)("p",{children:n("assignmentDetails.totalHours",{defaultValue:"Total Hours: {{hours}}",hours:I})})]}),bordered:!0,dataSource:Z,renderItem:e=>(0,s.jsx)(o.Z.Item,{actions:[(0,s.jsx)(f.ZP,{onClick:()=>P(e),disabled:a,children:n("assignmentDetails.edit",{defaultValue:"Edit"})}),(0,s.jsx)(v.Z,{title:n("assignmentDetails.deleteLogConfirm",{defaultValue:"Are you sure you want to delete this log?"}),onConfirm:()=>k(e._id),disabled:a,children:(0,s.jsx)(f.ZP,{danger:!0,disabled:a,children:n("assignmentDetails.delete",{defaultValue:"Delete"})})})],children:(0,s.jsxs)(u.Z,{children:[T()(e.startTime).format("YYYY-MM-DD HH:mm")," -"," ",T()(e.endTime).format("YYYY-MM-DD HH:mm")," (",T()(e.endTime).diff(T()(e.startTime),"hour",!0)," ","hours)"]})})}),(0,s.jsx)(f.ZP,{type:"primary",onClick:()=>P(),style:{marginTop:"10px"},disabled:a,children:n("assignmentDetails.addTimeLog",{defaultValue:"Add Time Log"})}),(0,s.jsx)(x.default,{title:m?n("assignmentDetails.editTimeLog",{defaultValue:"Edit Time Log"}):n("assignmentDetails.addTimeLog",{defaultValue:"Add Time Log"}),visible:i,onCancel:()=>{d(!1),g(null),y.resetFields()},onOk:()=>{let e=y.getFieldsValue();if(!e.startTime||!e.endTime){l.ZP.error(n("assignmentDetails.provideStartEnd",{defaultValue:"Please provide start and end times"}));return}N({logData:{startTime:e.startTime.toISOString(),endTime:e.endTime.toISOString(),comments:e.comments}})},okButtonProps:{disabled:a},children:(0,s.jsxs)(b.Z,{form:y,layout:"vertical",name:"time logs form",children:[(0,s.jsx)(b.Z.Item,{label:n("assignmentDetails.startTime",{defaultValue:"Start Time"}),name:"startTime",rules:[{required:!0,message:n("assignmentDetails.enterStartTime",{defaultValue:"Please enter start time"})}],children:(0,s.jsx)(j.default,{showTime:!0,value:y.getFieldValue("startTime"),onChange:e=>F("startTime",e),disabled:a})}),(0,s.jsx)(b.Z.Item,{label:n("assignmentDetails.endTime",{defaultValue:"End Time"}),name:"endTime",rules:[{required:!0,message:n("assignmentDetails.enterEndTime",{defaultValue:"Please enter end time"})}],children:(0,s.jsx)(j.default,{showTime:!0,value:y.getFieldValue("endTime"),onChange:e=>F("endTime",e),disabled:a})}),(0,s.jsx)(b.Z.Item,{label:n("assignmentDetails.comments",{defaultValue:"Comments"}),name:"comments",children:(0,s.jsx)(p.default.TextArea,{rows:4,disabled:a})})]})})]})},{Title:M,Text:_}=Z.default;t.default=function(e){let{params:t}=e,a=t.slug,{t:l}=(0,c.$G)("common"),{data:i,refetch:r}=(0,S.useQuery)({queryKey:["assignment",a],queryFn:async()=>await (0,D.JU)(a)}),o=["completed","withdrawn"].includes(null==i?void 0:i.status),u="";return((null==i?void 0:i.status)==="completed"||(null==i?void 0:i.status)==="withdrawn")&&(u=l("assignmentDetails.taskStatusNoChanges",{defaultValue:"This task is {{status}} you can't make any changes",status:null==i?void 0:i.status})),(0,s.jsxs)("div",{className:"page-wrapper",children:[(0,s.jsxs)("div",{className:"flex items-center justify-end p-6",children:[(0,s.jsx)("p",{children:l("assignmentDetails.thisTaskIs",{defaultValue:"This task is :"})}),(0,s.jsx)(d.Z,{title:u,children:(0,s.jsx)(n.Z,{color:(null==i?void 0:i.status)==="completed"?"green":(null==i?void 0:i.status)==="in_progress"?"blue":(null==i?void 0:i.status)==="withdrawn"?"red":"default",children:null==i?void 0:i.status})})]}),(0,s.jsxs)(w.default,{children:[(0,s.jsx)("h2",{className:"text-2xl font-bold",children:l("assignmentDetails.title",{defaultValue:"Assignment Details"})}),(0,s.jsxs)(M,{level:3,children:[" ",null==i?void 0:i.title]}),(0,s.jsx)(_,{children:null==i?void 0:i.description}),(0,s.jsxs)(N.Z,{gutter:[16,16],justify:"space-between",children:[(0,s.jsx)(k.Z,{xs:24,md:24,children:(0,s.jsx)(P,{objectives:null==i?void 0:i.objectives,taskId:a,refetchAssignment:r,isDisabled:o})}),(0,s.jsx)(k.Z,{xs:24,md:24,children:(0,s.jsx)(F,{assignees:null==i?void 0:i.assignees})})]}),(0,s.jsxs)(N.Z,{gutter:[16,16],style:{marginTop:"20px"},children:[(0,s.jsx)(k.Z,{xs:24,md:24,children:(0,s.jsx)(V,{notes:null==i?void 0:i.notes,taskId:a,refetchAssignment:r,isDisabled:o})}),(0,s.jsx)(k.Z,{xs:24,md:24,children:(0,s.jsx)($,{taskId:a,isDisabled:o})})]})]})]})}},18156:function(e,t,a){a.d(t,{a$:function(){return A},yo:function(){return q}});var s=a(57437),l=a(15981),n=a(7224),i=a(66718),d=a(15461),r=a(71632),c=a(21770),o=a(44967),u=a(42264),m=a(93142),h=a(91652),f=a(89970),x=a(3810),g=a(9190),b=a(85180),v=a(72495),j=a(71134),p=a(22116),y=a(78871),T=a(16836),Z=a(52093),w=a(867),N=a(2265),k=a(69668),S=a(1065),D=a(30166),C=a(52273),P=a(11364),F=a(27648),I=a(71096),V=a.n(I),$=a(84535);let M=(0,D.default)(()=>Promise.all([a.e(29041),a.e(22177),a.e(85421)]).then(a.bind(a,85421)),{loadableGenerated:{webpack:()=>[85421]},ssr:!1}),_={toolbar:{items:["heading","|","bold","italic","|","bulletedList","numberedList","|","insertTable","|","undo","redo"]}
1,image:{toolbar:["imageStyle:full","imageStyle:side","|","imageTextAlternative"]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells"]},language:"en"},E=e=>{let{record:t}=e,{accessControl:a,accessiblePrograms:l}=t,n=e=>{switch(e){case"read/write":return"green";case"read":return"blue";case"no_access":return"red";default:return"default"}},i=e=>e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),d=e=>e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return(0,s.jsx)("div",{className:"p-4",children:(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Access Control"}),a&&Object.keys(a).length>0?(0,s.jsx)("div",{className:"space-y-3",children:Object.entries(a).filter(e=>{let[t,a]=e;return(null==a?void 0:a.access)!=="no_access"}).map(e=>{let[t,a]=e;return(0,s.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"font-medium",children:i(t)})}),(0,s.jsx)("div",{children:(0,s.jsx)(x.Z,{color:n(null==a?void 0:a.access),children:d(null==a?void 0:a.access)})})]},t)})}):(0,s.jsx)("div",{className:"text-gray-500 italic",children:"No access control settings defined"})]})})},A=e=>{let{record:t,taskId:a,refetch:l,canEdit:n=!1}=e;return(0,s.jsx)("div",{children:(0,s.jsx)("div",{className:"",children:(0,s.jsxs)(P.mQ,{children:[(0,s.jsxs)(P.td,{className:"flex gap-3 w-full",children:[(0,s.jsx)(P.OK,{onClick:()=>{},className:"cursor-pointer",children:(0,s.jsx)(j.ZP,{children:"Notes"})}),(0,s.jsx)(P.OK,{onClick:()=>{},className:"cursor-pointer",children:(0,s.jsx)(j.ZP,{children:"Time Sheet"})}),(0,s.jsx)(P.OK,{onClick:()=>{},className:"cursor-pointer",children:(0,s.jsx)(j.ZP,{children:"Objectives"})}),(0,s.jsx)(P.OK,{onClick:()=>{},className:"cursor-pointer",children:(0,s.jsx)(j.ZP,{children:"Permissions"})})]}),(0,s.jsx)(P.x4,{children:(0,s.jsx)(L,{record:t,taskId:a,refetch:l,canEdit:n})}),(0,s.jsx)(P.x4,{children:(0,s.jsx)("div",{className:"row",children:(0,s.jsx)("div",{className:"max-h-[calc(100vh-420px)] flex",children:(0,s.jsx)(O,{canEdit:n,record:t,taskId:a,refetch:l})})})}),(0,s.jsx)(P.x4,{children:(0,s.jsx)($.V,{canEdit:n,objectives:null==t?void 0:t.objectives,taskId:a,refetchAssignment:l,isDisabled:!1})}),(0,s.jsx)(P.x4,{children:(0,s.jsx)(E,{record:t})})]})})})},O=e=>{let{record:t,taskId:a,refetch:n,canEdit:d=!1}=e,[m,h]=(0,N.useState)(!1),[f,x]=(0,N.useState)(null),[g,b]=(0,N.useState)(0),[Z]=o.Z.useForm(),{data:k,isLoading:S,refetch:D}=(0,r.useQuery)({queryKey:["time-logs",a],queryFn:async()=>{try{var e,t;let s=await i.Z.search("TimeLog",100,1,{filters:{task:a},sort:{createdAt:-1}});return b(null==s?void 0:null===(e=s.data)||void 0===e?void 0:e.total),null==s?void 0:null===(t=s.data)||void 0===t?void 0:t.items}catch(e){return console.error(e),[]}}}),C=e=>V()(e).format("YYYY-MM-DD HH:mm"),P=(e,t)=>V()(t).diff(V()(e),"hour",!0).toFixed(2),F=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;Z.resetFields(),x(e),h(!0),e&&Z.setFieldsValue({...e,startTime:e.startTime?V()(e.startTime):null,endTime:e.endTime?V()(e.endTime):null})},I=()=>{h(!1),Z.resetFields(),x(null)},$=(e,t)=>{Z.setFieldsValue({["start"===t?"startTime":"endTime"]:e})},{mutate:M}=(0,c.useMutation)({mutationFn:async()=>{try{let e=Z.getFieldsValue();await (0,l.VS)(a,e.startTime.toISOString(),e.endTime.toISOString(),e.comments)}catch(e){console.error(e)}},onError:()=>{u.ZP.error("Failed to add time log")},onSuccess:()=>{u.ZP.success("Time log added"),D(),I()}}),{mutate:_}=(0,c.useMutation)({mutationFn:async()=>{try{let e=Z.getFieldsValue();await (0,l.he)(null==f?void 0:f._id,e.startTime.toISOString(),e.endTime.toISOString(),e.comments)}catch(e){console.error(e)}},onError:()=>{u.ZP.error("Failed to update time log")},onSuccess:()=>{u.ZP.success("Time log updated"),n(),I()}}),{mutate:E}=(0,c.useMutation)({mutationFn:async e=>{try{await (0,l.GI)(e)}catch(e){console.error(e)}},onError:()=>{u.ZP.error("Failed to delete time log")},onSuccess:()=>{u.ZP.success("Time log deleted"),n()}}
1),A=[{title:"Start Time",align:"left",dataIndex:"startTime",key:"startTime",render:e=>(0,s.jsx)("span",{children:C(e)})},{title:"End Time",align:"left",dataIndex:"endTime",key:"endTime",render:e=>(0,s.jsx)("span",{children:C(e)})},{title:"Comments",align:"left",dataIndex:"comments",key:"comments"},{title:"Duration",key:"duration",render:e=>(0,s.jsxs)("span",{children:[P(e.startTime,e.endTime)," hours"]})},{title:"Action",key:"action",render:(e,t)=>(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(j.ZP,{onClick:()=>F(t),disabled:!1,children:"Edit"}),(0,s.jsx)(w.Z,{title:"Are you sure you want to delete this time log?",okText:"Yes",cancelText:"No",onConfirm:()=>E(null==t?void 0:t._id),children:(0,s.jsx)(j.ZP,{danger:!0,children:"Delete"})})]})}].filter(e=>!!d||"action"!==e.key);return(0,s.jsxs)("div",{className:"flex flex-col gap-2 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Time logs"}),d&&(0,s.jsx)(j.ZP,{type:"primary",onClick:()=>F(),className:"ml-auto this-is-primary-button",children:"Add New Time Log"})]}),(0,s.jsx)(v.Z,{columns:A,dataSource:k||[],rowKey:"_id",pagination:!1,loading:S,locale:{emptyText:"No time logs found"}}),(0,s.jsx)(p.default,{visible:m,onCancel:I,onOk:()=>{let e=Z.getFieldsValue();e.startTime&&e.endTime&&(f&&(null==f?void 0:f._id)?_():M())},title:f?"Edit Time Log":"Add Time Log",children:(0,s.jsxs)(o.Z,{form:Z,layout:"vertical",name:"time logs form",children:[(0,s.jsx)(o.Z.Item,{label:"Start Time",name:"startTime",rules:[{required:!0,message:"Please enter start time"}],children:(0,s.jsx)(y.default,{showTime:!0,onOk:e=>$(e,"start")})}),(0,s.jsx)(o.Z.Item,{label:"End Time",name:"endTime",rules:[{required:!0,message:"Please enter end time"}],children:(0,s.jsx)(y.default,{showTime:!0,onOk:e=>$(e,"end")})}),(0,s.jsx)(o.Z.Item,{label:"Comment",name:"comments",children:(0,s.jsx)(T.default.TextArea,{rows:5})})]})})]})},L=e=>{var t;let{record:a,taskId:n,refetch:i,canEdit:d=!1}=e,[r,o]=N.useState(!1),[f,x]=N.useState(null),g=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;o(!0),x(e)},{mutate:b,status:v}=(0,c.useMutation)({mutationFn:async e=>{try{await (0,l.By)(n,null==f?void 0:f.content)}catch(e){}},onSuccess:()=>{u.ZP.success("Note added "),x(null),o(!1),i()},onError:()=>{u.ZP.error("Failed to add note")}}),{mutate:j,status:y}=(0,c.useMutation)({mutationFn:async()=>{try{await (0,l.Qk)(n,null==f?void 0:f._id,null==f?void 0:f.content)}catch(e){}},onSuccess:()=>{u.ZP.success("Note updated "),i(),x(null),o(!1)},onError:()=>{u.ZP.error("Failed to update not")}}),T="pending"==v||"pending"==y;return(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Notes"}),d&&(0,s.jsx)("button",{onClick:()=>{g()},className:"px-4 py-1 font-bold text-white bg-indigo-500 rounded hover:bg-indigo-700 this-is-primary-button",children:"Add Note"})]}),null==a?void 0:null===(t=a.notes)||void 0===t?void 0:t.map((e,t)=>{var a,l,n,i,r;return(0,s.jsxs)("div",{className:"flex justify-between p-2 rounded-md border",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:null==e?void 0:e.content}}),(0,s.jsxs)(m.Z,{size:"middle",children:[(0,s.jsx)(h.Z,{src:(null==e?void 0:null===(a=e.userID)||void 0===a?void 0:a.avatar)||"/avatar_holder.png"}),"".concat(null!==(i=null==e?void 0:null===(l=e.userId)||void 0===l?void 0:l.firstName)&&void 0!==i?i:""," ").concat(null!==(r=null==e?void 0:null===(n=e.userId)||void 0===n?void 0:n.lastName)&&void 0!==r?r:"")]})]}),d&&(0,s.jsx)("button",{onClick:()=>{g(e)},className:"px-4 py-1 font-bold text-white bg-indigo-500 rounded h-fit hover:bg-indigo-700 this-is-primary-button",children:"Edit"})]},t)}),(0,s.jsx)(p.default,{open:r,onCancel:()=>{o(!1)},onOk:()=>{!T&&(null==f?void 0:f.content)&&(f&&(null==f?void 0:f._id)?j():b())},title:f?"Edit Note":"Add Note",children:(0,s.jsx)(M,{config:_,data:(null==f?void 0:f.content)||"",disabled:!1,onChange:(e,t)=>
1{let a=null==t?void 0:t.getData();a&&x(e=>({...e,content:a}))}})})]})},q=e=>{let{isOpen:t,setIsOpen:a,contactPerson:l,ovverideContactPersonId:n=null}=e,[i,r]=N.useState(""),{mutate:o,status:m}=(0,c.useMutation)({mutationFn:async()=>{try{if(!i)return;await d.Z.sendMessage({content:i,chatId:null,receiverId:n||l._id})}catch(e){}},onSuccess:()=>{u.ZP.success("Message sent successfully"),a(!1),r("")},onError:e=>{u.ZP.error("Error in sending message")}});return(0,s.jsx)(p.default,{open:t,footer:null,onCancel:()=>a(!1),children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("label",{htmlFor:"message",children:"Message"}),(0,s.jsx)("textarea",{value:i,onChange:e=>r(e.target.value),rows:5,name:"message",id:"message",className:"form-control"})]}),(0,s.jsx)(j.ZP,{disabled:!i||"pending"===m,onClick:()=>{o()},className:"flex items-center pt-0 pb-0.5 mt-6 btn btn-primary",loading:"pending"===m,children:"Send"})]})})},Y=e=>{var t,a,l;let{isOpen:n,setIsOpen:i,item:d}=e,r=(0,S.Ti)({role:"ngo-company"}).filter(e=>null==e?void 0:e.display).filter(e=>{var t;return null==d?void 0:null===(t=d.accessControl)||void 0===t?void 0:t[null==e?void 0:e.id]});return(0,s.jsx)(p.default,{open:n,onCancel:()=>i(!1),footer:null,children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)("h4",{children:"Title:"}),(0,s.jsx)("p",{children:null==d?void 0:d.title}),(0,s.jsx)("h4",{children:"Description:"}),(0,s.jsx)("p",{children:null==d?void 0:d.description}),(null==d?void 0:d.dueDate)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{children:"Due Date:"}),(0,s.jsx)("p",{children:(0,Z.WU)(new Date(null==d?void 0:d.dueDate),"MMM dd yyy")})]}),(null==d?void 0:d.program)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h4",{children:"Program:"}),(0,s.jsx)(F.default,{href:"/dashboard/suitedetails?id=".concat(null==d?void 0:null===(t=d.program)||void 0===t?void 0:t._id),target:"_blank",children:(0,s.jsx)("p",{className:"text-blue-500",children:null==d?void 0:null===(a=d.program)||void 0===a?void 0:a.name})})]}),(null==d?void 0:d.accessControl)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{children:"Permissoins:"}),(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)("span",{children:"The admin gave you permission to these items in his account :"}),r.map(e=>(0,s.jsx)("span",{className:"font-semibold text-indigo-500",children:null==e?void 0:e.name}))]})]}),(null==d?void 0:d.objectives)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h4",{children:"Objectives:"}),(0,s.jsx)("div",{className:"flex flex-col gap-3",children:null==d?void 0:null===(l=d.objectives)||void 0===l?void 0:l.map((e,t)=>(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{children:null==e?void 0:e.title}),(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:(null==d?void 0:d.achieved)?"green":"grey",className:"size-6",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"})})]},t))})]})]})})};t.ZP=function(){let e=(0,C.g)(),[t,a]=N.useState(null),[d,j]=N.useState(null),[p,y]=N.useState(!1),[T,Z]=N.useState(null),[S,D]=N.useState(1),[P,I]=N.useState(0),[V,$]=N.useState("active"),[M]=o.Z.useForm(),{data:_}=(0,r.useQuery)({queryKey:["me"]}),E=async()=>{try{var e,t;let a={filters:{assignees:_._id,status:"active"===V?{$nin:["withdrawn","completed"]}:{$in:["withdrawn","completed"]}},sort:{createdAt:-1},populate:["contactPerson","user_id","program","notes.userId"]},s=await i.Z.search("JobTask",100,S,a);return I(null==s?void 0:null===(e=s.data)||void 0===e?void 0:e.total),null==s?void 0:null===(t=s.data)||void 0===t?void 0:t.items}catch(e){console.error("error in fetching assignments in my assignments",e)}},{data:O,error:L,isFetching:K,status:G,refetch:Q}=(0,r.useQuery)({queryKey:["assignments",S,V],queryFn:E}),{mutate:H,status:R}=(0,c.useMutation)({mutationFn:async e=>{try{await (0,l.QW)(null==e?void 0:e._id,null==e?void 0:e.status)}catch(e){}},onError:e=>{},onSuccess:()=>{u.ZP.success("Status changed successfully"),Q()}}),{mutate:B,status:U}=(0,c.useMutation)({mutationFn:async e=>{try{await (0,l.Mx)(e)}catch(e){}},onSuccess:()=>
1{u.ZP.success("Task selected"),e.invalidateQueries({queryKey:["me"]}),window.location.reload()},onError:()=>{u.ZP.error("An error accured")}}),W=[{title:"Title",align:"left",dataIndex:"title",key:"title",render:(e,t)=>(0,s.jsx)(F.default,{target:"_blank",href:"/dashboard/my-assignments/".concat(t._id),children:e})},{title:"Description",align:"left",dataIndex:"description",key:"description"},{title:"NGO",align:"left",dataIndex:"ngo",key:"user_id",render:e=>{var t;return(0,s.jsxs)(m.Z,{size:"middle",children:[(0,s.jsx)(h.Z,{src:(null==e?void 0:e.avatar)||"/avatar_holder.png"}),null!==(t=null==e?void 0:e.companyName)&&void 0!==t?t:""]})}},{title:"Contact Person",align:"left",dataIndex:"contactPerson",key:"teamMaster",render:e=>{var t,l;return(0,s.jsxs)(m.Z,{size:"middle",children:[(0,s.jsx)(h.Z,{src:(null==e?void 0:e.avatar)||"/avatar_holder.png"}),"".concat(null!==(t=null==e?void 0:e.firstName)&&void 0!==t?t:""," ").concat(null!==(l=null==e?void 0:e.lastName)&&void 0!==l?l:""),(0,s.jsx)(f.Z,{title:"Send message",children:(0,s.jsx)("button",{onClick:()=>{j(e),a(!0)},children:(0,s.jsx)(k.f3m,{})})})]})}},{title:"Due Date",align:"left",dataIndex:"dueDate",key:"dueDate"},{title:"Status",align:"left",dataIndex:"status",key:"status",render:e=>(0,s.jsx)(x.Z,{color:"".concat((0,n.Wg)(null!=e?e:"")),children:e})},{title:"Action",key:"action",render:(e,t)=>(0,s.jsxs)("div",{className:"flex flex-col gap-2 items-center md:flex-row w-fit",children:[(0,s.jsx)(g.default,{className:"w-24",onChange:e=>{H({...t,status:e})},disabled:"completed"===t.status||"pending"==R,children:[{title:"Start",status:"ongoing"},{title:"Pause",status:"paused"},{title:"Complete",status:"completed"},{title:"Withdraw",status:"withdrawn"}].map(e=>(0,s.jsx)(g.default.Option,{value:e.status,children:e.title}))}),(0,s.jsx)(f.Z,{title:" Start Work , by selecting this task your dashboard will update so you can access the task related resources. ",children:(0,s.jsx)(w.Z,{title:"Are you sure you want to start this task?",okText:"Yes",cancelText:"No",onConfirm:()=>{B(null==t?void 0:t._id)},children:(0,s.jsx)("button",{className:"px-2 py-1 ml-auto whitespace-nowrap rounded-md border",children:"Start Work"})})}),(0,s.jsx)("button",{onClick:()=>{z(t)},className:"px-2 py-1 ml-auto rounded-md border",children:"Details"})]})}],z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;y(!0),M.resetFields(),Z(e),e&&M.setFieldsValue({...e})},J=e=>{D(e)};return(0,s.jsxs)("div",{className:"my-6",children:[(0,s.jsx)("h1",{children:"My Assignments"}),(0,s.jsxs)("div",{className:"flex justify-end items-center",children:[(0,s.jsx)("button",{onClick:()=>{$("active")},className:"".concat("active"===V?"bg-indigo-500 text-white":""," px-4 py-1 rounded-md"),children:"Active"}),(0,s.jsx)("button",{onClick:()=>{$("historie")},className:"".concat("historie"===V?"bg-indigo-500 text-white":""," px-4 py-1 rounded-md"),children:"History"})]}),O&&0!==O.length?(0,s.jsx)(v.Z,{pagination:!1,columns:W,dataSource:O||[],rowKey:"_id",scroll:{scrollToFirstRowOnChange:!0,x:1300},expandable:{expandedRowRender:e=>(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(A,{record:e,taskId:e._id,refetch:Q})}),rowExpandable:e=>"Not Expandable"!==e.name}}):(0,s.jsx)("div",{className:"p-8 mt-4 text-center bg-white rounded-lg border border-gray-100 shadow-sm",children:(0,s.jsx)(b.Z,{image:b.Z.PRESENTED_IMAGE_SIMPLE,imageStyle:{height:80},description:(0,s.jsxs)("div",{className:"flex flex-col gap-2 items-center",children:[(0,s.jsx)("span",{className:"text-base text-gray-600",children:"No assignments found"}),(0,s.jsx)("span",{className:"text-gray-500",children:"Start applying to volunteer opportunities to see assignments here"})]})})}),!!(P&&P>10)&&(0,s.jsxs)("div",{className:"flex justify-between mt-5",children:[(0,s.jsxs)("span",{children:["Page ",S," of ",Math.
1ceil(P/10)]}),(0,s.jsxs)("div",{className:"flex gap-3 font-semibold text-indigo-500",children:[(0,s.jsx)("button",{onClick:()=>J(S-1),disabled:S<=1,children:"Previous"}),(0,s.jsx)("button",{onClick:()=>J(S+1),disabled:S>=P/10,children:"Next"})]})]}),(0,s.jsx)(q,{isOpen:t,setIsOpen:a,contactPerson:d}),p&&(0,s.jsx)(Y,{isOpen:p,setIsOpen:y,item:T})]})}},15981:function(e,t,a){a.d(t,{By:function(){return n},GI:function(){return o},JU:function(){return u},Mx:function(){return d},QW:function(){return l},Qk:function(){return i},VS:function(){return r},he:function(){return c},s2:function(){return m}}),a(83079);var s=a(12119);(0,s.$)("e2e0fc42eb8629a34d47b3bf94bcf0565ccdd962"),(0,s.$)("da6ca06bc9d5c1de5f399a325e3c52778ba63ee5"),(0,s.$)("226f0c138190d5f389905866240e542ec4880b84"),(0,s.$)("3daf3a99f510024f8a5454a97faef16d928f4c9a"),(0,s.$)("67c6bc7bea4180f70dda15fea9f31dfe5953b79d"),(0,s.$)("95f74d2d75956451ec6603024a56172312c7142e"),(0,s.$)("7542e58acac67f6b80d62f8288380cec3b800f51"),(0,s.$)("fd82c7df5d086059b3ebc3a03505716d8499b8f8"),(0,s.$)("eff475e2099217cc8443e8ee50689b74d60094c9"),(0,s.$)("cb40d5c11314c9808f3572d839c9d9b9ab0e4a1e"),(0,s.$)("08f0b007292cceaf9c438b153ecb66b4a7b1d22c"),(0,s.$)("34d69b8206a0131698c37365f37ffad56f89847b"),(0,s.$)("ed70564f3ea9bd1aaa0080ce5c30de713e1c0103"),(0,s.$)("ecbda98d9f2abd16d6130f5f7748874cda67e2d0"),(0,s.$)("f42a8b700fe2615f3a24688d80f329244e5ee859"),(0,s.$)("131b61ab7d3eec1ce11a32ddd7792db4cf88b68d"),(0,s.$)("184977d33b0a397fefdbb726a48b1e1fc7fe4324"),(0,s.$)("453c7b3473fc40da4ff4a4a445d10d7169a8ca8b"),(0,s.$)("8083b5b2d54ba41d6fb4a720317939ed1d47e9a4"),(0,s.$)("1d51fe03f086bd171daace441dc4d007f7c35c4a"),(0,s.$)("e69aad9f7cff8bd4ea41b24ff3b8278ebfa69108"),(0,s.$)("71093ecf722cfae0d2d62a54c47d28a2b2bcda93");var l=(0,s.$)("0ea10a23937d98d444d9997b03bf47738ca8eae3"),n=(0,s.$)("b3d49af4bfb45a3bfd2d31177d02978f787ed6ee"),i=(0,s.$)("fe572df37299ca51b7fd328f08074be787dafb2b"),d=(0,s.$)("c384695dc201ae7824a50df4a4ddba7beeeffd8b"),r=(0,s.$)("0a439a318535601d90ee39d37cb77e5061433062"),c=(0,s.$)("9745670507da3bb05f4094c45e1d7c955f70f055");(0,s.$)("593fd0ffbdea20a4238f9ea7c47a051370ef0642"),(0,s.$)("5347f224ecd4a1218067f9828013e9452c081d09"),(0,s.$)("5df7fd76b295fc0574c5943fdc2c150a84e7b4d7");var o=(0,s.$)("4ae05bd84b6ed3e2ddec24d06a7f9df645e72f48");(0,s.$)("94aee2e4e4c5d1d295e97e357c349f4e09312de1"),(0,s.$)("7449bc8f0f1f15a903dfd942aeab4f2f671615b1"),(0,s.$)("b76b2c2cc12f2dca88e333051598aa383be7aed8");var u=(0,s.$)("7f521177be0bba08a293f3e377f2f311847b84f8"),m=(0,s.$)("64178da79faad898e1909e029b2bafe844bbfbd8");(0,s.$)("c8c2965e29d0031de7f9420b35f977c27c6fad86"),(0,s.$)("ac6cca029a95c90ba449fb4fe3e5dbc338ff3127"),(0,s.$)("544943920127485d16ca26f5bc6f402be4cdb276"),(0,s.$)("4c9ad2d6a6b8e0806ab1cf16d4e2d24dd4b14e7f"),(0,s.$)("64f36738d80d0d3b9d5ed69b90705ba903fdce3f"),(0,s.$)("dd5c3e9f7c6c42b8cd091e68186cea78164e0586")},15461:function(e,t,a){var s=a(83464),l=a(34848),n=a(33349);class i{fetchChats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.api.get("/chat/fetchChats?page=".concat(e,"&keyword=").concat(t))}fetchMessages(e){let{chatId:t,page:a=1,keyword:s=""}=e;return this.api.get("/chat/fetchMessages?chatId=".concat(t,"&page=").concat(a,"&keyword=").concat(s))}markMessagesRead(e){return this.api.post("/chat/markMessagesRead",{chatId:e})}sendMessage(e){let{content:t,chatId:a="",receiverId:s}=e;return this.api.post("/chat/sendMessage",{content:t,chatId:a,receiverId:s})}searchMessages(e,t){return this.api.get("/chat/fetchMessages",{params:{chatId:e,keyword:t}})}searchChats(e){return this.api.get("/chat/fetchChats",{params:{keyword:e}})}deleteChat(e){return this.api.delete("/chat/deleteChat?chatId=".concat(e))}getChat(e){return this.api.get("/chat/getChat?partnerId=".concat(e))}constructor(e){this.api=s.Z.create({baseURL:e}),(0,l.K)(this.api)}}t.Z=new i("".concat((0,n.getBackendUrl)()))}}]);
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.