@geowiki/evoland 0.16.9-dev.3 → 0.16.9-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as ProjectDetails, b as default } from '../chunk-
|
|
1
|
+
export { a as ProjectDetails, b as default } from '../chunk-6ISEMUG4.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as TaskPerLocationList } from '../chunk-
|
|
1
|
+
export { a as TaskPerLocationList } from '../chunk-HMI4WGWB.mjs';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { dynamic, useRouter, useProjectDetails, useGroupsInProject, useProjectUsers, useProjectsPointsDownload, useLocationBulkUpload, useTaskBulkUpload, useReviewTaskBulkUpload, useProjectResultSet, useProjectStatisticsByUser, useContractStatisticsByUser, useUpdateActiveGroupInProject, downloadJSON, downloadData } from '@geowiki/core';
|
|
2
|
+
import { TaskService } from '@geowiki/evoland-api-proxy';
|
|
3
|
+
import { LoaderFull, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, OldCustomInput, PieChart } from '@geowiki/ui';
|
|
4
|
+
import Fe from '@geowiki/map/src/store/evoland';
|
|
5
|
+
import { useState, useRef } from 'react';
|
|
6
|
+
import { createTask } from '@geowiki/map/src/utils/EvolandUtils';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var Ee=dynamic(()=>import('./Projects/ProjectMap.mjs'),{loading:()=>jsx("p",{children:"Loading..."}),ssr:false}),Be=n=>{let v=useRouter(),i=parseInt(v.query.projectId),f=Fe(),[w,T]=useState(false),[de,ne]=useState(true),[U,M]=useState(false),[x,A]=useState(true),{data:s}=useProjectDetails(i,x),{data:d}=useGroupsInProject(i,w),{data:m}=useProjectUsers(i),{data:F}=useProjectsPointsDownload(i,U,n.userRole),[b,G]=useState(null),[u,k]=useState("2024-01-01"),[p,E]=useState(new Date().toISOString().split("T")[0]),h=useRef(null),j=useRef(null),C=useRef(null),[B,O]=useState(false),[D,V]=useState([0,"Select Group"]),[W,$]=useState(null),[q,Y]=useState(null),[J,z]=useState(null),[H,Q]=useState(null),[K,X]=useState(null),{data:Z,isLoading:ce}=useLocationBulkUpload(B,W,i,D[0]),{data:ee,isLoading:me}=useTaskBulkUpload(q,J,i),{data:te,isLoading:ue}=useReviewTaskBulkUpload(H,K,i),[I,R]=useState(false),[se,ae]=useState(false),{data:P,isLoading:pe}=useProjectResultSet(I,i,se),_=[{clusterColor:"#03C988",annotatedClusterColor:"#d5a6bd",pinColor:"brown",annotatedPinColor:"yellow"},{clusterColor:"#45818e",annotatedClusterColor:"#f1c232",pinColor:"blue",annotatedPinColor:"white"},{clusterColor:"#660000",annotatedClusterColor:"#c90076",pinColor:"green",annotatedPinColor:"indigo"},{clusterColor:"#5f6600",annotatedClusterColor:"#0068c9",pinColor:"pink",annotatedPinColor:"aqua"},{clusterColor:"#8703c9",annotatedClusterColor:"#61c900",pinColor:"orange",annotatedPinColor:"purple"}];n.userRole=="admin"&&s&&de&&(k(s?.start_date),ne(false));let{data:y}=useProjectStatisticsByUser(i,u,p,b),{data:ge}=useContractStatisticsByUser(i,u,p,b);s!==void 0&&x&&!w&&A(!x);let L=(e,o="data.xlsx")=>{g?.length==0||g?.filter(r=>r.value!==0).length==0?alert("No data to download"):downloadData(e,o);},g=[{label:"Submitted",value:y?.statistics?.reduce((e,o)=>e+o.submitted_tasks,0)},{label:"Accepted",value:y?.statistics?.reduce((e,o)=>e+o.accepted_tasks,0)},{label:"In Review",value:y?.statistics?.reduce((e,o)=>e+o.in_review_tasks,0)}],[c,ve]=useState(d?.filter(e=>e.is_active===true)[0]?(d?.filter(e=>e.is_active===true)[0]).group_id:0),{data:oe,isLoading:le}=useUpdateActiveGroupInProject(i,c,w);if(!le&&oe?.success&&(T(false),alert(oe?.success?"Active group updated successfully as "+d?.filter(e=>e.group_id==c)[0].group_name:"Please try again")),le)return jsx(LoaderFull,{});if(n.userRole=="admin"&&F&&(L(F,s?.project_name+"_locations.xlsx"),M(false)),Z&&!ce){let e=new Date(Date.now());O(false),$(null),downloadJSON(Z,"locations_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json"),V([0,"Select Group"]);}if(ee&&!me){let e=new Date(Date.now());Y(false),z(null),downloadJSON(ee,"tasks_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json");}if(te&&!ue){let e=new Date(Date.now());Q(false),X(null),downloadJSON(te,"review_tasks_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json");}if(P&&!pe){let e=new Date(Date.now());R(false),se?downloadJSON(P,s.project_name+"_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".geojson"):downloadData(P,s.project_name+"_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".csv");}return jsxs("div",{className:"bg-white lg:px-2",children:[jsxs("div",{className:"flex",children:[n.userRole=="admin"&&jsxs("div",{className:"w-[25%] flex-col",children:[jsx("div",{className:"w-50 text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Manage"}),jsxs("fieldset",{className:"border p-4 rounded m-4",children:[jsx("legend",{children:"Upload"}),jsxs("div",{className:"flex",children:["Locations",jsxs("div",{className:"ml-5",children:[jsx("input",{ref:h,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>$(e.target.files[0])}),jsxs("div",{className:"flex flex-row pb-3",children:[jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{className:"w-full text-sm p-2 bg-primary h-8 text-secondary",children:D[1]}),jsx(DropdownMenuContent,{children:d?.sort((e,o)=>o.is_active-e.is_active).map((e,o)=>jsx(DropdownMenuItem,{className:"text-xs",id:""+e.group_id,onSelect:()=>{V([e.group_id,e.group_name]);},children:e.group_name},o))})]}),jsx("div",{className:"w-6 h-6 ml-2",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(D[0]!=0&&W&&!B?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{O(true),h.current&&(h.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload locations for selected group"})]})})]})]})]}),jsxs("div",{className:"flex pt-3",children:["Tasks",jsxs("div",{className:"ml-5 flex",children:[jsx("input",{ref:j,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>z(e.target.files[0])}),jsx("div",{className:"w-6 h-6 ml-1",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(J&&!q?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{Y(true),j.current&&(j.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload tasks for this project"})]})})]})]}),jsxs("div",{className:"flex pt-3",children:["Review",jsxs("div",{className:"ml-5 flex",children:[jsx("input",{ref:C,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>X(e.target.files[0])}),jsx("div",{className:"w-6 h-6 ml-1",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(K&&!H?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{Q(true),C.current&&(C.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload review tasks for this project"})]})})]})]})]}),jsxs("fieldset",{className:"border p-4 rounded m-4",children:[jsx("legend",{children:"Download"}),s?.meta_data?.QUESTIONNAIRE&&s?.meta_data?.QUESTIONNAIRE==true&&jsxs("div",{className:"flex",children:[jsx("div",{children:"Questionnaire"}),jsx("a",{className:"pl-2 w-10 underline text-primary "+(I?"pointer-events-none":"hover:cursor-pointer"),onClick:()=>{R(true),ae(false);},children:"CSV"}),jsx("a",{className:"pl-2 underline text-primary "+(I?"pointer-events-none":"hover:cursor-pointer"),onClick:()=>{R(true),ae(true);},children:"Geo Json"})]})]})]}),jsxs("div",{className:"items-center justify-center flex flex-col border-gray-200 border-2 "+(n.userRole=="admin"?"w-[55%]":"w-full"),children:[jsx("div",{className:"text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Details"}),jsxs("div",{className:"px-4 sm:px-0 w-full",children:[jsx("div",{className:"mt-6 border-t border-gray-100 w-full",children:jsxs("dl",{className:"divide-y divide-gray-100 text-left lg:px-8 xl:px-12 ",children:[jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Title"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-lg text-gray-700 sm:col-span-2 sm:mt-0",children:s?.project_name})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Id"}),jsx("dd",{title:n.userRole=="admin"?"Download all location's coordinates for this project":"",className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0"+(n.userRole=="admin"&&!U?" underline text-primary hover:cursor-pointer":""),onClick:()=>{M(true);},children:s?.project_id})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"No of Points in group"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0",children:s?.n_locations_group})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Overall project progress"}),jsxs("dd",{className:"mt-1 sm:col-span-2 sm:mt-0 flex flex-row ",children:[jsx("div",{style:{width:(s?.proj_completed_locations||0)/(s?.n_locations||1)*100+"%"},className:"bg-primary text-xs",title:"Completed: "+s?.proj_completed_locations}),jsx("div",{style:{width:(s?.proj_submitted_locations||0)/(s?.n_locations||1)*100+"%"},className:"bg-green-300 text-xs",title:"Submitted: "+s?.proj_submitted_locations}),jsx("div",{style:{width:100-((s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0))/(s?.n_locations||1)*100+"%"},className:"bg-gray-300 text-xs",title:"Remaining: "+((s?.n_locations||0)-((s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0)))}),jsxs("div",{className:"text-xs flex items-center",children:[(s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0),"/",s?.n_locations]})]})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Overall group progress"}),jsxs("dd",{className:"mt-1 sm:col-span-2 sm:mt-0 flex flex-row ",children:[jsx("div",{style:{width:(s?.group_completed_locations||0)/(s?.n_locations_group||1)*100+"%"},className:"bg-primary text-xs",title:"Completed: "+s?.group_completed_locations}),jsx("div",{style:{width:(s?.group_submitted_locations||0)/(s?.n_locations_group||1)*100+"%"},className:"bg-green-300 text-xs",title:"Submitted: "+s?.group_submitted_locations}),jsx("div",{style:{width:100-((s?.group_completed_locations||0)+(s?.group_submitted_locations||0))/(s?.n_locations_group||1)*100+"%"},className:"bg-gray-300 text-xs",title:"Remaining: "+((s?.n_locations_group||0)-((s?.group_completed_locations||0)+(s?.group_submitted_locations||0)))}),jsxs("div",{className:"text-xs flex items-center",children:[(s?.group_completed_locations||0)+(s?.group_submitted_locations||0),"/",s?.n_locations_group]})]})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"My progress in current group"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0",children:s?.user_contributions})]})]})}),jsxs("ul",{role:"list",className:"px-2 w-full",children:[jsxs("li",{className:"border border-gray-700 m-5 flex",children:[jsx("div",{className:"items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-6 text-gray-900",children:"My Statistics"})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-3 py-4 text-sm leading-6 flex",children:[jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"All submissions"}),jsx("dd",{className:"text-gray-700",children:jsx("div",{className:"font-medium text-gray-900",children:Math.round((s?.user_tasks_in_review||0)+(s?.user_tasks_to_fix||0)+(s?.user_discarded_tasks||0)+(s?.user_tasks_accepted||0)+(s?.user_task_submitted||0))})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"In Review"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_in_review})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"To Fix"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_to_fix})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Discarded"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_discarded_tasks})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Accepted"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_accepted})})]})]})]},"userStats"),n.userRole=="admin"&&jsxs(Fragment,{children:[jsxs("li",{className:"flex border border-gray-700 m-5",children:[jsx("div",{className:"items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-6 text-gray-900",children:"Project Statistics"})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-6 py-4 text-sm leading-6 flex",children:[jsxs("div",{className:"flex items-center mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"In Review"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_in_review})})]}),jsxs("div",{className:"flex items-center ml-4 mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"To Fix"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_to_fix})})]}),jsxs("div",{className:"flex items-center ml-4 mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Accepted"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_accepted})})]})]})]},"projectStats"),jsxs("li",{className:"border border-gray-700 m-5 h-50 overflow-y-scroll",children:[jsx("div",{className:"flex items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-4 text-gray-900",children:"Groups in Project"})}),jsxs("dl",{className:"flex flex-row px-6 py-2 text-sm leading-6 bg-gray-200",children:[jsx("div",{className:"mr-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Name"})}),jsx("div",{className:"ml-2 mr-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Locations"})}),jsx("div",{className:"ml-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Status"})})]}),d?.sort((e,o)=>o.is_active-e.is_active).map((e,o)=>jsxs("dl",{className:"flex flex-row px-6 py-4 text-sm leading-6 -my-3 divide-y divide-gray-100",children:[jsx("dt",{className:"mr-2 font-medium text-gray-900 w-full",children:e.group_name}),jsx("dt",{className:"ml-2 mr-2 font-medium text-gray-900 w-full",children:e.n_locations}),jsx("dt",{className:"ml-2 font-medium text-gray-900 w-full",children:jsx("div",{className:e.is_active?"":"underline text-blue-500 hover:cursor-pointer",title:e.is_active?"":"Make this current active group",onClick:()=>{e.is_active||(T(true),A(!x),ve(e.group_id));},children:e.is_active?"Active":"Not Active"})})]},o))]},"groupsInProject")]})]})]})]}),jsxs("div",{className:"w-[20%] ml-5 flex-col",children:[jsx("div",{className:"text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Data"}),jsxs("div",{className:"mb-2 text-xs",children:[jsxs("div",{className:"mt-1 inline-flex",children:[jsx("div",{children:"From"}),jsx(OldCustomInput,{cssClass:"h-5 flex text-xs text-black ml-1",displayText:"From",noDisplayTextAsLabel:true,type:"date",value:u,onChange:e=>{k(e.toString());}})]}),jsxs("div",{className:"inline-flex ml-1 mt-1",children:[jsx("div",{className:"w-6",children:"To"}),jsx(OldCustomInput,{cssClass:"h-5 flex text-xs text-black ml-1",displayText:"To",noDisplayTextAsLabel:true,type:"date",value:p,onChange:e=>{E(e.toString());}})]})]}),jsx("div",{className:"inline-flex",children:m&&jsxs("select",{className:"text-xs",onChange:e=>{e.target.selectedIndex!==0?(G(m[e.target.selectedIndex-1].user_alias),k(m[e.target.selectedIndex-1].contract_start_date?m[e.target.selectedIndex-1].contract_start_date:u),E(m[e.target.selectedIndex-1].contract_end_date?m[e.target.selectedIndex-1].contract_end_date:p),localStorage.setItem("searchUser",m[e.target.selectedIndex-1].user_alias)):(G(null),localStorage.removeItem("searchUser"));},children:[jsx("option",{value:"0",children:"Select User"}),m?.map((e,o)=>jsx("option",{value:e.user_id,selected:b==e.user_alias,children:e.user_alias},o))]})}),jsxs("div",{className:"ml-2 inline-flex",children:[jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 pt-1 hover:cursor-pointer",onClick:()=>{L(y?.statistics.map(e=>({user_id:e.user_id,user_alias:e.user_alias,submitted_tasks:e.submitted_tasks,in_review_tasks:e.in_review_tasks,accepted_tasks:e.accepted_tasks,skipped_tasks:e.skipped_tasks,user_discarded_tasks:e.user_discarded_tasks,discarded_tasks:e.discarded_tasks,to_fix_tasks:e.to_fix_tasks,all_finished_tasks:e.all_finished_tasks,min_time:e.min_time,max_time:e.max_time,mean_time:e.mean_time})),"Project_data_"+u+"_"+p+".xlsx");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}),jsx("title",{children:"Download Project data"})]}),n.userRole=="admin"&&jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 pt-1 bg-primary rounded text-white hover:cursor-pointer",onClick:()=>L(ge?.statistics,"Contractual_data.xlsx"),children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}),jsx("title",{children:"Download Contractual data"})]})]}),jsxs("div",{children:[g?.length==0||g?.filter(e=>e.value!==0).length==0&&jsx("div",{className:"pt-5 text-center",children:"No Data"}),jsx(PieChart,{innerRadius:0,outerRadius:100,data:g?.filter(e=>e.value!==0)})]})]})]}),jsx("div",{className:"mx-auto max-w-screen pt-4 text-center",children:jsx(Ee,{projectId:i,userRole:n.userRole,handleClusterExpand:e=>{createTask(e.location_id,i,s.project_reference_date.toString()).then(({location:o,currentTask:r,annotation_dates:fe})=>{o&&f.setLocation(o),r?(f.setCurrentTask(r),f.setAnnotationDates(fe),v.push(`/map?projectId=${i}&locationId=${e.location_id}&taskId=${r?.task_id}`).then()):alert("No task for you on this location");});},clusterColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].clusterColor,annotatedClusterColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].annotatedClusterColor,pinColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].pinColor,annotatedPinColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].annotatedPinColor,handleStart:async e=>{let o={project_id:i,only_not_submitted:true,reference_date:s?.project_reference_date.toString(),to_fix:e};var r=await TaskService.getNextLocationNexttaskPost(o);r!=null&&(r.exists==false&&r.location==null?(alert("No more locations are left to "+(e?"fix":"annotate")+" for you"),v.push("/evoland/projects")):r.location!=null&&r.task==null?alert("Please try again"):(f.setTimerReset(true),v.push(`/map?projectId=${i}&locationId=${r.location?.location_id}&taskId=${r.task?.task_id}`).then()));}})})]})},Xe=Be;
|
|
10
|
+
|
|
11
|
+
export { Be as a, Xe as b };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useRouter, useTasksPerLocation, useTaskComments, Link, TaskStatus, TaskStatusColor } from '@geowiki/core';
|
|
3
|
+
import L from 'react-data-table-component';
|
|
4
|
+
import { OldCustomInput, Button, Tabs, TabsList, TabsTrigger } from '@geowiki/ui';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var K=b=>{let h=useRouter(),[a,g]=useState("All");var[n,T]=useState(0);let l=10;var[c,v]=useState(),[r,u]=useState();let[s,k]=useState("-last_update_time"),o=h.query.projectId,I=[{name:"Task ID",sortField:"id",selector:e=>e.task_id,cell:e=>jsx(Link,{className:"text-xs underline text-primary-600 hover:bg-primary-700",href:a=="Review"?`/map?projectId=${o}&locationId=${e.location_id}&taskId=${e.task_id}&review=true`:`/map?projectId=${o}&locationId=${e.location_id}&taskId=${e.task_id}`,target:"_blank",children:e.task_id}),sortable:true},{name:"Group",sortField:"group_name",selector:e=>e.location_group,sortable:true},{name:"Last Update",sortField:"last_update_time",selector:e=>new Date(e.last_update_time).toLocaleDateString()+" "+(new Date(e.last_update_time).getHours()<10?"0"+new Date(e.last_update_time).getHours():new Date(e.last_update_time).getHours())+":"+(new Date(e.last_update_time).getMinutes()<10?"0"+new Date(e.last_update_time).getMinutes():new Date(e.last_update_time).getMinutes()),sortable:true},{name:"User",sortField:"user_alias",selector:e=>e.user_alias,sortable:true},{name:"Project",selector:e=>e.project_id},{name:"Location",sortField:"location_id",selector:e=>e.location_id,sortable:true},{name:"Status",sortField:"status",selector:e=>e.status,cell:e=>jsx("div",{style:{backgroundColor:TaskStatusColor[e.status]},className:"rounded-lg text-xs pl-1 pr-1",children:TaskStatus[e.status]}),sortable:true},{name:"Comment",cell:(e,m)=>jsx("div",{children:y!==void 0?y.comments[m]:e.index})}],{data:d,isLoading:_}=useTasksPerLocation(s?.includes("location")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),locationOrderBy:s,search:r||null}:s?.includes("user")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),userOrderBy:s,search:r||null}:s?.includes("group")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),groupOrderBy:s.split("group_")[1],search:r||null}:{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),orderBy:s,search:r||null}),{data:y}=useTaskComments(d?.tasks.map(e=>e.task_id)||[]),S=e=>{var m=e-1;T(m);},C=e=>{s.includes(e.sortField)?k(s.includes("-")?e.sortField:"-"+e.sortField):k(e.sortField);},w=()=>d?.tasks,F={noRowsPerPage:true};return _?null:jsx("div",{className:" mx-auto px-2 h-auto",children:jsxs("div",{className:"items-center p-4",children:[jsx("div",{className:"flex",children:jsx("div",{className:"text-md font-semibold text-center leading-7 text-gray-900",children:"Tasks per Location"})}),jsx("div",{className:"flex",children:jsxs("div",{className:"text-md font-semibold text-center leading-7 text-gray-900 flex",children:[jsx(OldCustomInput,{name:"Search",type:"text",value:c,onKeyDown:e=>{e=="Enter"&&u(c);},onChange:e=>{v(e);}}),jsx(Button,{className:"ml-5 mt-2",onClick:()=>{u(c);},children:"Search"}),jsx(Button,{className:"ml-5 mt-2",onClick:()=>{v(""),u(null);},children:"Clear"})]})}),b.userRole=="admin"&&jsx(Tabs,{value:a,orientation:"vertical",className:"mt-2",children:jsxs(TabsList,{className:"w-30",children:[jsx(TabsTrigger,{value:"All",className:(a=="All"?"bg-primary text-secondary ":"bg-white text-primary ")+"w-full",asChild:true,children:jsx("div",{onClick:()=>g("All"),className:a=="All"?"pointer-events: none":"hover:cursor-pointer",children:"All"})}),jsx(TabsTrigger,{value:"Review",className:(a=="Review"?"bg-primary text-secondary ":"bg-white text-primary ")+"w-full",asChild:true,children:jsx("div",{onClick:()=>g("Review"),className:a=="Review"?"pointer-events: none":"hover:cursor-pointer",children:"Review"})})]})}),jsx("div",{className:"mx-auto px-4 py-5",children:jsx(L,{columns:I,data:d?.tasks??[],paginationTotalRows:d?.total_tasks,progressPending:_,paginationComponentOptions:F,pagination:true,paginationServer:true,onChangePage:S,sortFunction:w,onSort:C})})]})})};
|
|
8
|
+
|
|
9
|
+
export { K as a };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as ProjectDetails } from './chunk-
|
|
1
|
+
export { a as ProjectDetails } from './chunk-6ISEMUG4.mjs';
|
|
2
2
|
export { a as ProjectList } from './chunk-LGVI2HUZ.mjs';
|
|
3
|
-
export { a as TaskPerLocationList } from './chunk-
|
|
3
|
+
export { a as TaskPerLocationList } from './chunk-HMI4WGWB.mjs';
|
|
4
4
|
import './styles.css';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geowiki/evoland",
|
|
3
|
-
"version": "0.16.9-dev.
|
|
3
|
+
"version": "0.16.9-dev.5",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"types": "./dist/index.d.mts",
|
|
6
6
|
"files": [
|
|
@@ -12,20 +12,19 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"next": "15.5.3",
|
|
16
15
|
"react": "^18.2.0",
|
|
17
16
|
"leaflet": "^1.9.4",
|
|
18
17
|
"react-leaflet": "^4.2.1",
|
|
19
18
|
"react-dom": "^18.2.0",
|
|
20
|
-
"@geowiki/
|
|
21
|
-
"@geowiki/evoland-api-proxy": "0.16.9-dev.
|
|
22
|
-
"@geowiki/evoland-orval-api-proxy": "0.16.9-dev.
|
|
23
|
-
"@geowiki/
|
|
24
|
-
"@geowiki/
|
|
25
|
-
"@geowiki/ui": "0.16.9-dev.
|
|
19
|
+
"@geowiki/api-proxy": "0.16.9-dev.5",
|
|
20
|
+
"@geowiki/evoland-api-proxy": "0.16.9-dev.5",
|
|
21
|
+
"@geowiki/evoland-orval-api-proxy": "0.16.9-dev.5",
|
|
22
|
+
"@geowiki/core": "0.16.9-dev.5",
|
|
23
|
+
"@geowiki/map": "0.16.9-dev.5",
|
|
24
|
+
"@geowiki/ui": "0.16.9-dev.5"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
|
28
|
-
"@headlessui/react": "
|
|
27
|
+
"@headlessui/react": "2.1.0",
|
|
29
28
|
"react-data-table-component": "^7.5.3",
|
|
30
29
|
"@heroicons/react": "^2.0.18"
|
|
31
30
|
},
|
package/dist/chunk-KGI5BCCH.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { useTasksPerLocation, useTaskComments, TaskStatus, TaskStatusColor } from '@geowiki/core';
|
|
3
|
-
import L from 'react-data-table-component';
|
|
4
|
-
import { OldCustomInput, Button, Tabs, TabsList, TabsTrigger } from '@geowiki/ui';
|
|
5
|
-
import B from 'next/link';
|
|
6
|
-
import { useRouter } from 'next/router';
|
|
7
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var K=b=>{let h=useRouter(),[a,g]=useState("All");var[n,T]=useState(0);let l=10;var[c,v]=useState(),[r,u]=useState();let[s,k]=useState("-last_update_time"),o=h.query.projectId,I=[{name:"Task ID",sortField:"id",selector:e=>e.task_id,cell:e=>jsx(B,{className:"text-xs underline text-primary-600 hover:bg-primary-700",href:a=="Review"?`/map?projectId=${o}&locationId=${e.location_id}&taskId=${e.task_id}&review=true`:`/map?projectId=${o}&locationId=${e.location_id}&taskId=${e.task_id}`,target:"_blank",children:e.task_id}),sortable:true},{name:"Group",sortField:"group_name",selector:e=>e.location_group,sortable:true},{name:"Last Update",sortField:"last_update_time",selector:e=>new Date(e.last_update_time).toLocaleDateString()+" "+(new Date(e.last_update_time).getHours()<10?"0"+new Date(e.last_update_time).getHours():new Date(e.last_update_time).getHours())+":"+(new Date(e.last_update_time).getMinutes()<10?"0"+new Date(e.last_update_time).getMinutes():new Date(e.last_update_time).getMinutes()),sortable:true},{name:"User",sortField:"user_alias",selector:e=>e.user_alias,sortable:true},{name:"Project",selector:e=>e.project_id},{name:"Location",sortField:"location_id",selector:e=>e.location_id,sortable:true},{name:"Status",sortField:"status",selector:e=>e.status,cell:e=>jsx("div",{style:{backgroundColor:TaskStatusColor[e.status]},className:"rounded-lg text-xs pl-1 pr-1",children:TaskStatus[e.status]}),sortable:true},{name:"Comment",cell:(e,m)=>jsx("div",{children:y!==void 0?y.comments[m]:e.index})}],{data:d,isLoading:_}=useTasksPerLocation(s?.includes("location")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),locationOrderBy:s,search:r||null}:s?.includes("user")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),userOrderBy:s,search:r||null}:s?.includes("group")?{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),groupOrderBy:s.split("group_")[1],search:r||null}:{taskForReview:a!="All",pageIdx:n,pageSize:l,locationProjectId:parseInt(o),orderBy:s,search:r||null}),{data:y}=useTaskComments(d?.tasks.map(e=>e.task_id)||[]),S=e=>{var m=e-1;T(m);},C=e=>{s.includes(e.sortField)?k(s.includes("-")?e.sortField:"-"+e.sortField):k(e.sortField);},w=()=>d?.tasks,F={noRowsPerPage:true};return _?null:jsx("div",{className:" mx-auto px-2 h-auto",children:jsxs("div",{className:"items-center p-4",children:[jsx("div",{className:"flex",children:jsx("div",{className:"text-md font-semibold text-center leading-7 text-gray-900",children:"Tasks per Location"})}),jsx("div",{className:"flex",children:jsxs("div",{className:"text-md font-semibold text-center leading-7 text-gray-900 flex",children:[jsx(OldCustomInput,{name:"Search",type:"text",value:c,onKeyDown:e=>{e=="Enter"&&u(c);},onChange:e=>{v(e);}}),jsx(Button,{className:"ml-5 mt-2",onClick:()=>{u(c);},children:"Search"}),jsx(Button,{className:"ml-5 mt-2",onClick:()=>{v(""),u(null);},children:"Clear"})]})}),b.userRole=="admin"&&jsx(Tabs,{value:a,orientation:"vertical",className:"mt-2",children:jsxs(TabsList,{className:"w-30",children:[jsx(TabsTrigger,{value:"All",className:(a=="All"?"bg-primary text-secondary ":"bg-white text-primary ")+"w-full",asChild:true,children:jsx("div",{onClick:()=>g("All"),className:a=="All"?"pointer-events: none":"hover:cursor-pointer",children:"All"})}),jsx(TabsTrigger,{value:"Review",className:(a=="Review"?"bg-primary text-secondary ":"bg-white text-primary ")+"w-full",asChild:true,children:jsx("div",{onClick:()=>g("Review"),className:a=="Review"?"pointer-events: none":"hover:cursor-pointer",children:"Review"})})]})}),jsx("div",{className:"mx-auto px-4 py-5",children:jsx(L,{columns:I,data:d?.tasks??[],paginationTotalRows:d?.total_tasks,progressPending:_,paginationComponentOptions:F,pagination:true,paginationServer:true,onChangePage:S,sortFunction:w,onSort:C})})]})})};
|
|
10
|
-
|
|
11
|
-
export { K as a };
|
package/dist/chunk-Z3RFB5I2.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useRouter } from 'next/router';
|
|
2
|
-
import { useProjectDetails, useGroupsInProject, useProjectUsers, useProjectsPointsDownload, useLocationBulkUpload, useTaskBulkUpload, useReviewTaskBulkUpload, useProjectResultSet, useProjectStatisticsByUser, useContractStatisticsByUser, useUpdateActiveGroupInProject, downloadJSON, downloadData } from '@geowiki/core';
|
|
3
|
-
import { TaskService } from '@geowiki/evoland-api-proxy';
|
|
4
|
-
import { LoaderFull, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, OldCustomInput, PieChart } from '@geowiki/ui';
|
|
5
|
-
import Ae from 'next/dynamic';
|
|
6
|
-
import Fe from '@geowiki/map/src/store/evoland';
|
|
7
|
-
import { useState, useRef } from 'react';
|
|
8
|
-
import { createTask } from '@geowiki/map/src/utils/EvolandUtils';
|
|
9
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
var Ee=Ae(()=>import('./Projects/ProjectMap.mjs'),{loading:()=>jsx("p",{children:"Loading..."}),ssr:false}),Be=n=>{let v=useRouter(),i=parseInt(v.query.projectId),f=Fe(),[w,T]=useState(false),[de,ne]=useState(true),[U,M]=useState(false),[x,A]=useState(true),{data:s}=useProjectDetails(i,x),{data:d}=useGroupsInProject(i,w),{data:m}=useProjectUsers(i),{data:F}=useProjectsPointsDownload(i,U,n.userRole),[b,G]=useState(null),[u,k]=useState("2024-01-01"),[p,E]=useState(new Date().toISOString().split("T")[0]),h=useRef(null),j=useRef(null),C=useRef(null),[B,O]=useState(false),[D,V]=useState([0,"Select Group"]),[W,$]=useState(null),[q,Y]=useState(null),[J,z]=useState(null),[H,Q]=useState(null),[K,X]=useState(null),{data:Z,isLoading:ce}=useLocationBulkUpload(B,W,i,D[0]),{data:ee,isLoading:me}=useTaskBulkUpload(q,J,i),{data:te,isLoading:ue}=useReviewTaskBulkUpload(H,K,i),[I,R]=useState(false),[se,ae]=useState(false),{data:P,isLoading:pe}=useProjectResultSet(I,i,se),_=[{clusterColor:"#03C988",annotatedClusterColor:"#d5a6bd",pinColor:"brown",annotatedPinColor:"yellow"},{clusterColor:"#45818e",annotatedClusterColor:"#f1c232",pinColor:"blue",annotatedPinColor:"white"},{clusterColor:"#660000",annotatedClusterColor:"#c90076",pinColor:"green",annotatedPinColor:"indigo"},{clusterColor:"#5f6600",annotatedClusterColor:"#0068c9",pinColor:"pink",annotatedPinColor:"aqua"},{clusterColor:"#8703c9",annotatedClusterColor:"#61c900",pinColor:"orange",annotatedPinColor:"purple"}];n.userRole=="admin"&&s&&de&&(k(s?.start_date),ne(false));let{data:y}=useProjectStatisticsByUser(i,u,p,b),{data:ge}=useContractStatisticsByUser(i,u,p,b);s!==void 0&&x&&!w&&A(!x);let L=(e,o="data.xlsx")=>{g?.length==0||g?.filter(r=>r.value!==0).length==0?alert("No data to download"):downloadData(e,o);},g=[{label:"Submitted",value:y?.statistics?.reduce((e,o)=>e+o.submitted_tasks,0)},{label:"Accepted",value:y?.statistics?.reduce((e,o)=>e+o.accepted_tasks,0)},{label:"In Review",value:y?.statistics?.reduce((e,o)=>e+o.in_review_tasks,0)}],[c,ve]=useState(d?.filter(e=>e.is_active===true)[0]?(d?.filter(e=>e.is_active===true)[0]).group_id:0),{data:oe,isLoading:le}=useUpdateActiveGroupInProject(i,c,w);if(!le&&oe?.success&&(T(false),alert(oe?.success?"Active group updated successfully as "+d?.filter(e=>e.group_id==c)[0].group_name:"Please try again")),le)return jsx(LoaderFull,{});if(n.userRole=="admin"&&F&&(L(F,s?.project_name+"_locations.xlsx"),M(false)),Z&&!ce){let e=new Date(Date.now());O(false),$(null),downloadJSON(Z,"locations_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json"),V([0,"Select Group"]);}if(ee&&!me){let e=new Date(Date.now());Y(false),z(null),downloadJSON(ee,"tasks_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json");}if(te&&!ue){let e=new Date(Date.now());Q(false),X(null),downloadJSON(te,"review_tasks_uploaded_on_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".json");}if(P&&!pe){let e=new Date(Date.now());R(false),se?downloadJSON(P,s.project_name+"_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".geojson"):downloadData(P,s.project_name+"_"+e.getDate()+"-"+e.getMonth()+"-"+e.getFullYear()+".csv");}return jsxs("div",{className:"bg-white lg:px-2",children:[jsxs("div",{className:"flex",children:[n.userRole=="admin"&&jsxs("div",{className:"w-[25%] flex-col",children:[jsx("div",{className:"w-50 text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Manage"}),jsxs("fieldset",{className:"border p-4 rounded m-4",children:[jsx("legend",{children:"Upload"}),jsxs("div",{className:"flex",children:["Locations",jsxs("div",{className:"ml-5",children:[jsx("input",{ref:h,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>$(e.target.files[0])}),jsxs("div",{className:"flex flex-row pb-3",children:[jsxs(DropdownMenu,{children:[jsx(DropdownMenuTrigger,{className:"w-full text-sm p-2 bg-primary h-8 text-secondary",children:D[1]}),jsx(DropdownMenuContent,{children:d?.sort((e,o)=>o.is_active-e.is_active).map((e,o)=>jsx(DropdownMenuItem,{className:"text-xs",id:""+e.group_id,onSelect:()=>{V([e.group_id,e.group_name]);},children:e.group_name},o))})]}),jsx("div",{className:"w-6 h-6 ml-2",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(D[0]!=0&&W&&!B?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{O(true),h.current&&(h.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload locations for selected group"})]})})]})]})]}),jsxs("div",{className:"flex pt-3",children:["Tasks",jsxs("div",{className:"ml-5 flex",children:[jsx("input",{ref:j,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>z(e.target.files[0])}),jsx("div",{className:"w-6 h-6 ml-1",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(J&&!q?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{Y(true),j.current&&(j.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload tasks for this project"})]})})]})]}),jsxs("div",{className:"flex pt-3",children:["Review",jsxs("div",{className:"ml-5 flex",children:[jsx("input",{ref:C,type:"file",className:"block w-full text-sm text-slate-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-violet-50 file:text-violet-700 hover:file:bg-violet-100",onChange:e=>X(e.target.files[0])}),jsx("div",{className:"w-6 h-6 ml-1",children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"size-6 "+(K&&!H?"hover:cursor-pointer":"pointer-events-none"),onClick:()=>{Q(true),C.current&&(C.current.value="");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"}),jsx("title",{children:"Upload review tasks for this project"})]})})]})]})]}),jsxs("fieldset",{className:"border p-4 rounded m-4",children:[jsx("legend",{children:"Download"}),s?.meta_data?.QUESTIONNAIRE&&s?.meta_data?.QUESTIONNAIRE==true&&jsxs("div",{className:"flex",children:[jsx("div",{children:"Questionnaire"}),jsx("a",{className:"pl-2 w-10 underline text-primary "+(I?"pointer-events-none":"hover:cursor-pointer"),onClick:()=>{R(true),ae(false);},children:"CSV"}),jsx("a",{className:"pl-2 underline text-primary "+(I?"pointer-events-none":"hover:cursor-pointer"),onClick:()=>{R(true),ae(true);},children:"Geo Json"})]})]})]}),jsxs("div",{className:"items-center justify-center flex flex-col border-gray-200 border-2 "+(n.userRole=="admin"?"w-[55%]":"w-full"),children:[jsx("div",{className:"text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Details"}),jsxs("div",{className:"px-4 sm:px-0 w-full",children:[jsx("div",{className:"mt-6 border-t border-gray-100 w-full",children:jsxs("dl",{className:"divide-y divide-gray-100 text-left lg:px-8 xl:px-12 ",children:[jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Title"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-lg text-gray-700 sm:col-span-2 sm:mt-0",children:s?.project_name})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Id"}),jsx("dd",{title:n.userRole=="admin"?"Download all location's coordinates for this project":"",className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0"+(n.userRole=="admin"&&!U?" underline text-primary hover:cursor-pointer":""),onClick:()=>{M(true);},children:s?.project_id})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"No of Points in group"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0",children:s?.n_locations_group})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Overall project progress"}),jsxs("dd",{className:"mt-1 sm:col-span-2 sm:mt-0 flex flex-row ",children:[jsx("div",{style:{width:(s?.proj_completed_locations||0)/(s?.n_locations||1)*100+"%"},className:"bg-primary text-xs",title:"Completed: "+s?.proj_completed_locations}),jsx("div",{style:{width:(s?.proj_submitted_locations||0)/(s?.n_locations||1)*100+"%"},className:"bg-green-300 text-xs",title:"Submitted: "+s?.proj_submitted_locations}),jsx("div",{style:{width:100-((s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0))/(s?.n_locations||1)*100+"%"},className:"bg-gray-300 text-xs",title:"Remaining: "+((s?.n_locations||0)-((s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0)))}),jsxs("div",{className:"text-xs flex items-center",children:[(s?.proj_completed_locations||0)+(s?.proj_submitted_locations||0),"/",s?.n_locations]})]})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"Overall group progress"}),jsxs("dd",{className:"mt-1 sm:col-span-2 sm:mt-0 flex flex-row ",children:[jsx("div",{style:{width:(s?.group_completed_locations||0)/(s?.n_locations_group||1)*100+"%"},className:"bg-primary text-xs",title:"Completed: "+s?.group_completed_locations}),jsx("div",{style:{width:(s?.group_submitted_locations||0)/(s?.n_locations_group||1)*100+"%"},className:"bg-green-300 text-xs",title:"Submitted: "+s?.group_submitted_locations}),jsx("div",{style:{width:100-((s?.group_completed_locations||0)+(s?.group_submitted_locations||0))/(s?.n_locations_group||1)*100+"%"},className:"bg-gray-300 text-xs",title:"Remaining: "+((s?.n_locations_group||0)-((s?.group_completed_locations||0)+(s?.group_submitted_locations||0)))}),jsxs("div",{className:"text-xs flex items-center",children:[(s?.group_completed_locations||0)+(s?.group_submitted_locations||0),"/",s?.n_locations_group]})]})]}),jsxs("div",{className:"px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0",children:[jsx("dt",{className:"text-sm leading-6 text-gray-900",children:"My progress in current group"}),jsx("dd",{className:"mt-1 leading-6 font-bold text-gray-700 sm:col-span-2 sm:mt-0",children:s?.user_contributions})]})]})}),jsxs("ul",{role:"list",className:"px-2 w-full",children:[jsxs("li",{className:"border border-gray-700 m-5 flex",children:[jsx("div",{className:"items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-6 text-gray-900",children:"My Statistics"})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-3 py-4 text-sm leading-6 flex",children:[jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"All submissions"}),jsx("dd",{className:"text-gray-700",children:jsx("div",{className:"font-medium text-gray-900",children:Math.round((s?.user_tasks_in_review||0)+(s?.user_tasks_to_fix||0)+(s?.user_discarded_tasks||0)+(s?.user_tasks_accepted||0)+(s?.user_task_submitted||0))})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"In Review"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_in_review})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"To Fix"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_to_fix})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Discarded"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_discarded_tasks})})]}),jsxs("div",{className:"flex items-center justify-between gap-x-4 py-3 mr-2 ml-4",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Accepted"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.user_tasks_accepted})})]})]})]},"userStats"),n.userRole=="admin"&&jsxs(Fragment,{children:[jsxs("li",{className:"flex border border-gray-700 m-5",children:[jsx("div",{className:"items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-6 text-gray-900",children:"Project Statistics"})}),jsxs("dl",{className:"-my-3 divide-y divide-gray-100 px-6 py-4 text-sm leading-6 flex",children:[jsxs("div",{className:"flex items-center mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"In Review"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_in_review})})]}),jsxs("div",{className:"flex items-center ml-4 mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"To Fix"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_to_fix})})]}),jsxs("div",{className:"flex items-center ml-4 mr-2 justify-between gap-x-4 py-3",children:[jsx("dt",{className:"text-gray-500 font-semibold",children:"Accepted"}),jsx("dd",{className:"flex items-start gap-x-2",children:jsx("div",{className:"font-medium text-gray-900",children:s?.project_tasks_accepted})})]})]})]},"projectStats"),jsxs("li",{className:"border border-gray-700 m-5 h-50 overflow-y-scroll",children:[jsx("div",{className:"flex items-center gap-x-4 border-b border-gray-900/5 bg-gray-50 p-4",children:jsx("div",{className:"text-sm font-semibold leading-4 text-gray-900",children:"Groups in Project"})}),jsxs("dl",{className:"flex flex-row px-6 py-2 text-sm leading-6 bg-gray-200",children:[jsx("div",{className:"mr-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Name"})}),jsx("div",{className:"ml-2 mr-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Locations"})}),jsx("div",{className:"ml-2 w-full",children:jsx("dt",{className:"text-gray-500",children:"Status"})})]}),d?.sort((e,o)=>o.is_active-e.is_active).map((e,o)=>jsxs("dl",{className:"flex flex-row px-6 py-4 text-sm leading-6 -my-3 divide-y divide-gray-100",children:[jsx("dt",{className:"mr-2 font-medium text-gray-900 w-full",children:e.group_name}),jsx("dt",{className:"ml-2 mr-2 font-medium text-gray-900 w-full",children:e.n_locations}),jsx("dt",{className:"ml-2 font-medium text-gray-900 w-full",children:jsx("div",{className:e.is_active?"":"underline text-blue-500 hover:cursor-pointer",title:e.is_active?"":"Make this current active group",onClick:()=>{e.is_active||(T(true),A(!x),ve(e.group_id));},children:e.is_active?"Active":"Not Active"})})]},o))]},"groupsInProject")]})]})]})]}),jsxs("div",{className:"w-[20%] ml-5 flex-col",children:[jsx("div",{className:"text-md text-center font-bold tracking-tight text-gray-900 m-5 sm:text-2xl",children:"Data"}),jsxs("div",{className:"mb-2 text-xs",children:[jsxs("div",{className:"mt-1 inline-flex",children:[jsx("div",{children:"From"}),jsx(OldCustomInput,{cssClass:"h-5 flex text-xs text-black ml-1",displayText:"From",noDisplayTextAsLabel:true,type:"date",value:u,onChange:e=>{k(e.toString());}})]}),jsxs("div",{className:"inline-flex ml-1 mt-1",children:[jsx("div",{className:"w-6",children:"To"}),jsx(OldCustomInput,{cssClass:"h-5 flex text-xs text-black ml-1",displayText:"To",noDisplayTextAsLabel:true,type:"date",value:p,onChange:e=>{E(e.toString());}})]})]}),jsx("div",{className:"inline-flex",children:m&&jsxs("select",{className:"text-xs",onChange:e=>{e.target.selectedIndex!==0?(G(m[e.target.selectedIndex-1].user_alias),k(m[e.target.selectedIndex-1].contract_start_date?m[e.target.selectedIndex-1].contract_start_date:u),E(m[e.target.selectedIndex-1].contract_end_date?m[e.target.selectedIndex-1].contract_end_date:p),localStorage.setItem("searchUser",m[e.target.selectedIndex-1].user_alias)):(G(null),localStorage.removeItem("searchUser"));},children:[jsx("option",{value:"0",children:"Select User"}),m?.map((e,o)=>jsx("option",{value:e.user_id,selected:b==e.user_alias,children:e.user_alias},o))]})}),jsxs("div",{className:"ml-2 inline-flex",children:[jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 pt-1 hover:cursor-pointer",onClick:()=>{L(y?.statistics.map(e=>({user_id:e.user_id,user_alias:e.user_alias,submitted_tasks:e.submitted_tasks,in_review_tasks:e.in_review_tasks,accepted_tasks:e.accepted_tasks,skipped_tasks:e.skipped_tasks,user_discarded_tasks:e.user_discarded_tasks,discarded_tasks:e.discarded_tasks,to_fix_tasks:e.to_fix_tasks,all_finished_tasks:e.all_finished_tasks,min_time:e.min_time,max_time:e.max_time,mean_time:e.mean_time})),"Project_data_"+u+"_"+p+".xlsx");},children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}),jsx("title",{children:"Download Project data"})]}),n.userRole=="admin"&&jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-6 h-6 pt-1 bg-primary rounded text-white hover:cursor-pointer",onClick:()=>L(ge?.statistics,"Contractual_data.xlsx"),children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}),jsx("title",{children:"Download Contractual data"})]})]}),jsxs("div",{children:[g?.length==0||g?.filter(e=>e.value!==0).length==0&&jsx("div",{className:"pt-5 text-center",children:"No Data"}),jsx(PieChart,{innerRadius:0,outerRadius:100,data:g?.filter(e=>e.value!==0)})]})]})]}),jsx("div",{className:"mx-auto max-w-screen pt-4 text-center",children:jsx(Ee,{projectId:i,userRole:n.userRole,handleClusterExpand:e=>{createTask(e.location_id,i,s.project_reference_date.toString()).then(({location:o,currentTask:r,annotation_dates:fe})=>{o&&f.setLocation(o),r?(f.setCurrentTask(r),f.setAnnotationDates(fe),v.push(`/map?projectId=${i}&locationId=${e.location_id}&taskId=${r?.task_id}`).then()):alert("No task for you on this location");});},clusterColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].clusterColor,annotatedClusterColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].annotatedClusterColor,pinColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].pinColor,annotatedPinColor:_[d&&c!=0?d?.findIndex(e=>e.group_id==c):0].annotatedPinColor,handleStart:async e=>{let o={project_id:i,only_not_submitted:true,reference_date:s?.project_reference_date.toString(),to_fix:e};var r=await TaskService.getNextLocationNexttaskPost(o);r!=null&&(r.exists==false&&r.location==null?(alert("No more locations are left to "+(e?"fix":"annotate")+" for you"),v.push("/evoland/projects")):r.location!=null&&r.task==null?alert("Please try again"):(f.setTimerReset(true),v.push(`/map?projectId=${i}&locationId=${r.location?.location_id}&taskId=${r.task?.task_id}`).then()));}})})]})},Xe=Be;
|
|
12
|
-
|
|
13
|
-
export { Be as a, Xe as b };
|