Institute works v2#238
Open
Choco-10 wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces the Institute Works Department (IWD) v2 frontend module, wiring up a new /institute-works area with role-based workflow tabs, API integrations, and new SLA/Inventory/Feedback capabilities.
Changes:
- Added a full IWD module shell with role-based tabs for request lifecycle, approvals, proposals, billing, vendor management, and tracking.
- Added new SLA Dashboard, Inventory Management, and Feedback & Case Management views (plus corresponding API endpoints/routes).
- Wired navigation: sidebar link now routes to
/institute-works, andApp.jsxregisters the route.
Reviewed changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/instituteWorksRoutes/index.jsx | Defines IWD v2 API endpoint constants, including new SLA/inventory/feedback routes. |
| src/Modules/InstituteWorks/api.js | Adds axios API layer for all IWD flows (requests, approvals, bills, vendors, SLA, inventory, feedback). |
| src/Modules/InstituteWorks/index.jsx | Implements IWD module entry with role-based tab visibility and active tab tracking. |
| src/Modules/InstituteWorks/CreateRequestView.jsx | Request creation flow with designation loading and access gating. |
| src/Modules/InstituteWorks/CreatedRequestsView.jsx | Lists created requests and shows tracking history modal. |
| src/Modules/InstituteWorks/RequestsStatusView.jsx | Loads and displays request status table for the current role. |
| src/Modules/InstituteWorks/DirectorApprovedView.jsx | Director-approved requests list + issue work order modal workflow. |
| src/Modules/InstituteWorks/WorkProgressView.jsx | Engineer work-progress list with “mark completed” action. |
| src/Modules/InstituteWorks/RequestsInProgressView.jsx | Displays requests currently in progress. |
| src/Modules/InstituteWorks/AdminApprovalQueueView.jsx | Admin approval queue for engineer-processed requests with action modal. |
| src/Modules/InstituteWorks/DeanProcessingQueueView.jsx | Dean/HOD processing queue + forwarding modal flow. |
| src/Modules/InstituteWorks/DeanDirectorQueueView.jsx | Director decision queue for dean-processed requests + action modal. |
| src/Modules/InstituteWorks/ProposalBuilderView.jsx | Engineer proposal builder for requests without active proposals. |
| src/Modules/InstituteWorks/RejectedRequestsView.jsx | Resubmission flow for rejected requests with updated proposal modal. |
| src/Modules/InstituteWorks/BudgetManagementView.jsx | Budget add/edit/list management view. |
| src/Modules/InstituteWorks/BillGenerationView.jsx | Captures actual bill items and moves requests to generated-bills state. |
| src/Modules/InstituteWorks/BillProcessingView.jsx | Lists generated bills and enables PDF download. |
| src/Modules/InstituteWorks/BillAuditView.jsx | Auditor review flow for bills + forwarding to accounts. |
| src/Modules/InstituteWorks/BillSettlementView.jsx | Accounts settlement queue with settle action. |
| src/Modules/InstituteWorks/VendorManagementView.jsx | Vendor list + add-vendor modal for issued work orders. |
| src/Modules/InstituteWorks/SLADashboardView.jsx | SLA monitoring dashboard + escalations table with auto-refresh. |
| src/Modules/InstituteWorks/InventoryManagementView.jsx | Inventory list, filters, issue/receive actions, and recent transactions table. |
| src/Modules/InstituteWorks/FeedbackView.jsx | Feedback submission + reopen case workflow + recent feedback list. |
| src/Modules/InstituteWorks/components/InstituteWorksShell.jsx | Shared shell: breadcrumbs + module tabs wrapper. |
| src/Modules/InstituteWorks/components/RequestForm.jsx | Request creation form component. |
| src/Modules/InstituteWorks/components/InfoNotice.jsx | Simple informational notice component. |
| src/Modules/InstituteWorks/components/SectionStack.jsx | Layout helper wrapper for stacked sections. |
| src/Modules/InstituteWorks/components/CreatedRequestsTable.jsx | Table for created requests with SLA/deadline columns and tracking action. |
| src/Modules/InstituteWorks/components/TrackingHistoryModal.jsx | Modal rendering file tracking history. |
| src/Modules/InstituteWorks/components/RequestsStatusTable.jsx | Request status table including SLA deadline and approval badges. |
| src/Modules/InstituteWorks/components/DirectorApprovedTable.jsx | Table listing director-approved requests with issue action. |
| src/Modules/InstituteWorks/components/IssueWorkOrderModal.jsx | Modal for issuing work orders with date validation constraints. |
| src/Modules/InstituteWorks/components/WorkProgressTable.jsx | Work-under-progress table with “mark completed” action. |
| src/Modules/InstituteWorks/components/RequestsInProgressTable.jsx | Table for in-progress requests with work status badge. |
| src/Modules/InstituteWorks/components/ProposalRequestsTable.jsx | Table listing requests awaiting proposals. |
| src/Modules/InstituteWorks/components/ProposalItemsModal.jsx | Modal to create/resubmit proposals with itemized budgeting and attachments. |
| src/Modules/InstituteWorks/components/RejectedRequestsTable.jsx | Table for rejected requests with resubmit action. |
| src/Modules/InstituteWorks/components/AdminApprovalQueueTable.jsx | Table for admin approval queue. |
| src/Modules/InstituteWorks/components/AdminApprovalActionModal.jsx | Modal for admin approve/reject + forward + attachment. |
| src/Modules/InstituteWorks/components/DeanProcessingQueueTable.jsx | Table for dean processing queue + action trigger. |
| src/Modules/InstituteWorks/components/DeanProcessingActionModal.jsx | Modal for dean approve/reject + forward + attachment. |
| src/Modules/InstituteWorks/components/DeanDirectorQueueTable.jsx | Table for director queue on dean-processed items. |
| src/Modules/InstituteWorks/components/DeanDirectorActionModal.jsx | Modal for director approve/reject + remarks + attachment. |
| src/Modules/InstituteWorks/components/VendorManagementContent.jsx | Vendor management main content (selector + vendors list). |
| src/Modules/InstituteWorks/components/VendorFormModal.jsx | Modal to add a vendor to a work order. |
| src/Modules/InstituteWorks/components/BudgetAddForm.jsx | Budget creation form. |
| src/Modules/InstituteWorks/components/BudgetEditForm.jsx | Budget editing form. |
| src/Modules/InstituteWorks/components/BudgetListTable.jsx | Budget list table with edit action. |
| src/Modules/InstituteWorks/components/BillGenerationTable.jsx | Queue table for bill generation eligibility. |
| src/Modules/InstituteWorks/components/BillGenerationModal.jsx | Modal to enter actual bill items and generate bill. |
| src/Modules/InstituteWorks/components/BillProcessingTable.jsx | Lists generated bills and triggers PDF download. |
| src/Modules/InstituteWorks/components/BillAuditTable.jsx | Auditor queue table for bill review/forwarding. |
| src/Modules/InstituteWorks/components/BillAuditModal.jsx | Auditor modal showing bill items + remarks + attachment. |
| src/Modules/InstituteWorks/components/BillSettlementTable.jsx | Settlement queue table with “settle” action. |
| src/Modules/InstituteWorks/components/ForwardRequestModal.jsx | Generic forward-request modal component. |
| src/components/sidebarContent.jsx | Updates sidebar link to point IWD entry at /institute-works. |
| src/App.jsx | Registers /institute-works route under Layout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+100
to
+107
| function InstituteWorks() { | ||
| const dispatch = useDispatch(); | ||
| const role = useSelector((state) => state.user.role); | ||
| const [activeTab, setActiveTab] = useState("0"); | ||
| const normalizedRole = normalizeRole(role); | ||
| const engineerUser = isEngineerRole(normalizedRole); | ||
|
|
||
| const tabsConfig = useMemo( |
Comment on lines
+6
to
+7
| Dialog, | ||
| Grid, |
Comment on lines
+204
to
+262
| items.map((item) => ( | ||
| <Table.Tr | ||
| key={item.id} | ||
| style={{ | ||
| backgroundColor: item.is_low_stock ? "#ffe0e0" : undefined, | ||
| }} | ||
| > | ||
| <Table.Td fw={500}>{item.name}</Table.Td> | ||
| <Table.Td size="sm">{item.description || "-"}</Table.Td> | ||
| <Table.Td>{item.unit}</Table.Td> | ||
| <Table.Td fw={500}>{item.quantity_available}</Table.Td> | ||
| <Table.Td>{item.reorder_level}</Table.Td> | ||
| <Table.Td> | ||
| {item.is_low_stock ? ( | ||
| <Badge color="red" variant="filled"> | ||
| LOW STOCK | ||
| </Badge> | ||
| ) : item.needs_procurement ? ( | ||
| <Badge color="orange" variant="filled"> | ||
| NO STOCK | ||
| </Badge> | ||
| ) : ( | ||
| <Badge color="green" variant="light"> | ||
| OK | ||
| </Badge> | ||
| )} | ||
| </Table.Td> | ||
| <Table.Td> | ||
| <Group gap="xs"> | ||
| <Button | ||
| size="xs" | ||
| variant="light" | ||
| color="blue" | ||
| onClick={() => { | ||
| setSelectedItem(item); | ||
| setIssueQuantity(1); | ||
| setIssueRemarks(""); | ||
| setIssueModalOpen(true); | ||
| }} | ||
| > | ||
| Issue | ||
| </Button> | ||
| <Button | ||
| size="xs" | ||
| variant="light" | ||
| color="green" | ||
| onClick={() => { | ||
| setSelectedItem(item); | ||
| setReceiveQuantity(1); | ||
| setReceiveRemarks(""); | ||
| setReceiveModalOpen(true); | ||
| }} | ||
| > | ||
| Receive | ||
| </Button> | ||
| </Group> | ||
| </Table.Td> | ||
| </Table.Tr> | ||
| )) |
| @@ -0,0 +1,58 @@ | |||
| import { useEffect, useMemo, useState } from "react"; | |||
Comment on lines
+6
to
+31
| getDesignations, | ||
| getGeneratedBills, | ||
| downloadBillPdf, | ||
| } from "./api"; | ||
|
|
||
| function BillProcessingView() { | ||
| const [rows, setRows] = useState([]); | ||
| const [designationOptions, setDesignationOptions] = useState([]); | ||
| const [isLoading, setIsLoading] = useState(false); | ||
|
|
||
| const load = async () => { | ||
| setIsLoading(true); | ||
| try { | ||
| const [billRows, designationsData] = await Promise.all([ | ||
| getGeneratedBills(), | ||
| getDesignations(), | ||
| ]); | ||
| setRows(billRows); | ||
|
|
||
| const options = (designationsData?.holdsDesignations || []).map( | ||
| (item) => ({ | ||
| value: `${item.designation?.name || ""}|${item.username || ""}`, | ||
| label: `${item.designation?.name || "Unknown"} (${item.username || "-"})`, | ||
| }), | ||
| ); | ||
| setDesignationOptions(options); |
| @@ -0,0 +1,80 @@ | |||
| import { useEffect, useMemo, useState } from "react"; | |||
Comment on lines
+135
to
+138
| const requestOptions = completedRequests.map((req) => ({ | ||
| value: req.id?.toString() || "", | ||
| label: `Request #${req.id} - ${req.name} (${req.area})`, | ||
| })); |
Comment on lines
+193
to
+194
| {overdue_requests.map((req, idx) => ( | ||
| <Table.Tr key={idx} style={{ backgroundColor: "#ffe0e0" }}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frontend Code for Institute Works Department