Tender Review and Posting ITQ/RFQ/EOI/TOR tenders
Key Features:
-
Tender Review Process:
- Fetching and displaying detailed tender information based on a unique identifier (
tender-id). - Managing the approval/review process with status tracking (e.g.,
Approved,Declined,Pending).
- Fetching and displaying detailed tender information based on a unique identifier (
-
Data Handling:
- Dynamic updates for tender details, status, and unique status across different components and tabs.
- Conditional rendering of components and messages based on tender and approval statuses.
-
Document Management:
- Generation and display of PDF files (
EOIandTOR) for review. - Downloading government attachments related to tenders.
- Generation and display of PDF files (
-
Step and Tab Navigation:
- Switching between tabs (
EOIandTOR) with associated data rendering. - Editable functionality based on the tender’s current status.
- Switching between tabs (
-
Error Handling and Notifications:
- Using
toastnotifications for feedback on actions like approval, decline, or tender posting. - Safeguarding against invalid actions with error checks (e.g., missing
serial_id).
- Using
Key Functionalities:
-
Data Fetching:
- Fetching Tender Details:
- Retrieves data using the
tenderServiceAPI, including tender details, unique status, and approvers’ status.
- Retrieves data using the
- Fetching PDFs:
- Uses
documentServiceto generate and fetch PDF files for review (EOI,TOR).
- Uses
Example:
const tenderDetailsResponse = await tenderService.getTenderBySerialId(reviewTenderParam);const pdfUrl = await documentService.generatePdfFileTOR(reviewTenderParam); - Fetching Tender Details:
-
Approval and Status Management:
- Tracks approval statuses using the
setTenderStatusstate. - Handles tender approval/decline with comments and updates using
updateTenderStatus.
Example:
const updateTenderStatus = async (status) => {const dataToUpdate = {serial_id: tenderDetails?.serial_id,status,action_taken_by: user,comment: comment.trim(),};await tenderService.updateTender(dataToUpdate);}; - Tracks approval statuses using the
-
Dynamic State Updates:
- Conditionally enables editing or posting of tenders based on their status.
- Populates approver feedback history and dynamically updates UI components.
-
Navigation and File Handling:
- Redirects to appropriate pages (
handelEditandhandelPostTender) and downloads files (handelDownload).
- Redirects to appropriate pages (
Data Fetching and Step Handling:
-
Flow of Data:
- The component initializes by fetching the
tender-idfrom query parameters. - Uses asynchronous functions to fetch tender details, approval status, and associated data.
- Processes and updates states like
tenderDetails,tenderStatus, andassignReviewersList.
- The component initializes by fetching the
-
Step and State Management:
- Approval steps are handled via conditions in the
tenderStatusstate, including checks for pending or declined statuses. useEffecthooks monitor changes in states liketenderStatusand trigger side effects to update dependent data.
Example:
useEffect(() => {if (tenderStatus) {const hasPending = tenderStatus.result.some(({ status }) => status === 'Pending');setEnableEditMode(hasPending);}}, [tenderStatus]); - Approval steps are handled via conditions in the
-
Tab Management:
- Switches between
EOIandTORtabs, loading the appropriate PDF and status details.
Example:
const handleTabChange = (tab) => {setCurrentTab(tab === 'EOI' ? 0 : 1);}; - Switches between
Code Snippet for Reference:
Fetching Tender Details and Updating States:
useEffect(() => { if (reviewTenderParam) { const fetchTender = async () => { setLoadingReview(true); try { const tenderDetailsResponse = await tenderService.getTenderBySerialId(reviewTenderParam); setTenderDetails(tenderDetailsResponse.tender); const pdfUrl = await documentService.generatePdfFileTOR(reviewTenderParam); setGeneratedPdf(window.URL.createObjectURL(new Blob([pdfUrl], { type: 'application/pdf' }))); } catch (error) { console.error('Error fetching tender details:', error); } finally { setLoadingReview(false); } }; fetchTender(); }}, [reviewTenderParam]);This structure ensures efficient data handling, robust error management, and seamless user interaction for the tender review process.