Compare commits
No commits in common. "bcb273d66318b223c48d499b4511858888f1a482" and "85cae0a78667e7218a1d67413bb57081f94d2a3a" have entirely different histories.
bcb273d663
...
85cae0a786
@ -92,7 +92,7 @@ const onSubmit = async(data) => {
|
|||||||
let response = await TasksRepository.assignTask( formattedData );
|
let response = await TasksRepository.assignTask( formattedData );
|
||||||
showToast( "Task Successfully Assigend", "success" )
|
showToast( "Task Successfully Assigend", "success" )
|
||||||
reset()
|
reset()
|
||||||
onClose()
|
closeModal()
|
||||||
} catch ( error )
|
} catch ( error )
|
||||||
{
|
{
|
||||||
showToast("something wrong","error")
|
showToast("something wrong","error")
|
||||||
|
|||||||
@ -41,14 +41,7 @@ const ManageProjectInfo = ( {project,handleSubmitForm, onClose} ) =>
|
|||||||
return num;
|
return num;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
} ) .refine((data) => {
|
} )
|
||||||
const start = new Date(data.startDate);
|
|
||||||
const end = new Date(data.endDate);
|
|
||||||
return end > start;
|
|
||||||
}, {
|
|
||||||
path: ['endDate'], // attaches the error to the endDate field
|
|
||||||
message: 'End Date must be greater than Start Date',
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
const {register, control, handleSubmit, formState: {errors}, reset, getValues} = useForm( {
|
const {register, control, handleSubmit, formState: {errors}, reset, getValues} = useForm( {
|
||||||
|
|||||||
@ -85,19 +85,6 @@ const ProjectList = () =>
|
|||||||
? Math.ceil(projectList.length / itemsPerPage)
|
? Math.ceil(projectList.length / itemsPerPage)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
const statusMap = {
|
|
||||||
1: { label: 'active', priority: 1 },
|
|
||||||
2: { label: 'hold', priority: 2 },
|
|
||||||
3: { label: 'inactive', priority: 3 },
|
|
||||||
4: { label: 'complete', priority: 4 }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const sortedProjects = [...currentItems].sort((a, b) => {
|
|
||||||
const aPriority = statusMap[+a.projectStatusId]?.priority ?? 99;
|
|
||||||
const bPriority = statusMap[+b.projectStatusId]?.priority ?? 99;
|
|
||||||
return aPriority - bPriority;
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -132,7 +119,7 @@ const ProjectList = () =>
|
|||||||
{" "}
|
{" "}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`btn btn-xs btn-primary ${!HasManageProject && 'd-none' }`}
|
className={`btn btn-sm btn-primary ${!HasManageProject && 'd-none' }`}
|
||||||
data-bs-toggle="modal"
|
data-bs-toggle="modal"
|
||||||
data-bs-target="#create-project-model"
|
data-bs-target="#create-project-model"
|
||||||
onClick={handleShow}
|
onClick={handleShow}
|
||||||
@ -164,10 +151,8 @@ const ProjectList = () =>
|
|||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{loading && <p className="text-center">Loading...</p>}
|
{loading && <p className="text-center">Loading...</p>}
|
||||||
|
|
||||||
|
|
||||||
{currentItems &&
|
{currentItems &&
|
||||||
sortedProjects.map((item) => (
|
currentItems.sort((a, b) => b.id - a.id).map((item) => (
|
||||||
<ProjectCard projectData={item} key={item.id}></ProjectCard>
|
<ProjectCard projectData={item} key={item.id}></ProjectCard>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user