send review task strict timeline implemented

This commit was merged in pull request #807.
This commit is contained in:
victorAnumudu
2024-10-03 09:27:27 +01:00
parent 7bb78772f7
commit 146e8b383e
@@ -8,6 +8,10 @@ import usersService from '../../../services/UsersService'
function CurrentTaskAction({jobDetails}) { function CurrentTaskAction({jobDetails}) {
const currTime = new Date().getTime() / (1000*60*60)
const deliveryTime = new Date(jobDetails?.delivery_date).getTime() / (1000*60*60)
const canSendForReview = currTime >= (deliveryTime - Number(jobDetails?.strict_timeline ? jobDetails.strict_timeline : 0)) // calculation to determine when send for review button will be active
const apiCall = new usersService() const apiCall = new usersService()
const navigate = useNavigate() const navigate = useNavigate()
@@ -120,8 +124,9 @@ function CurrentTaskAction({jobDetails}) {
</button> </button>
</div> </div>
<div className="job-action-modal-body w-full px-10 py-8 gap-4"> <div className="job-action-modal-body w-full px-10 py-8 gap-4">
<div className="w-full flex flex-col items-center"> <div className="w-full flex flex-col gap-8 items-center">
<div className="mb-10 flex justify-center items-center gap-2"> <>
<div className="flex justify-center items-center gap-2">
<input <input
type='checkbox' type='checkbox'
checked={checked} checked={checked}
@@ -131,17 +136,22 @@ function CurrentTaskAction({jobDetails}) {
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>If you have completed this task</p> <p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>If you have completed this task</p>
</div> </div>
<div className="mb-10 flex justify-center items-center"> <div className="flex justify-center items-center">
{reqStatus.loading ? {reqStatus.loading ?
<LoadingSpinner color='sky-blue' size='10' /> <LoadingSpinner color='sky-blue' size='10' />
: :
<button type="button" onClick={taskCompletedSubmit} className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"> <button
type="button"
onClick={taskCompletedSubmit}
className={`px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white ${!canSendForReview && 'pointer-events-none'}`}
>
Send for Review & Acceptance Send for Review & Acceptance
</button> </button>
} }
</div> </div>
{/* FOR SUCCESS/ERROR DISPLAY SECTION*/} {/* FOR SUCCESS/ERROR DISPLAY SECTION*/}
{reqStatus.message &&
<div className="w-full"> <div className="w-full">
<div <div
className={`relative p-4 text-center text-md font-light leading-[19.5px] text-[13px] ${reqStatus.status ? 'text-green-700':'text-[#912741]'}`} className={`relative p-4 text-center text-md font-light leading-[19.5px] text-[13px] ${reqStatus.status ? 'text-green-700':'text-[#912741]'}`}
@@ -149,7 +159,21 @@ function CurrentTaskAction({jobDetails}) {
{reqStatus.message} {reqStatus.message}
</div> </div>
</div> </div>
}
{/* END OF FOR SUCCESS/ERROR DISPLAY SECTION*/} {/* END OF FOR SUCCESS/ERROR DISPLAY SECTION*/}
{!canSendForReview &&
<>
<h1
// className='font-bold text-base tracking-wide text-dark-gray dark:text-white'
className='font-bold text-xl tracking-wide text-red-500 text-center'
>
This task requires you use about 80% of the time allocated
</h1>
</>
}
</>
</div> </div>
</div> </div>
{/* cancel btn */} {/* cancel btn */}