Add Modify button handler to enable PO editing from dashboard

Problem:
- The "Modify" button in the Action Queue (Panel de Control) did nothing when clicked
- Previously removed handleModify function and onModify prop during earlier refactoring
- Users couldn't open the purchase order modal in edit mode from the dashboard

Solution:
- Added handleModify function that sets poModalMode to 'edit' before opening modal
- Updated handleViewDetails to explicitly set mode to 'view' for clarity
- Passed onModify handler to ActionQueueCard component

How it works:
- View button -> Opens modal in view mode (read-only)
- Modify button -> Opens modal in edit mode (editable fields)
- Both use the same PurchaseOrderDetailsModal component
- Modal's initialMode prop controls which mode is shown first

Now users can:
- Click "View Details" to see PO information
- Click "Modify" to edit priority, delivery date, notes, and product quantities
- See real-time updates as they edit quantities and prices

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Urtzi Alfaro
2025-11-18 12:14:13 +01:00
parent a26bcc779e
commit c9246dec25

View File

@@ -119,8 +119,16 @@ export function NewDashboardPage() {
}; };
const handleViewDetails = (actionId: string) => { const handleViewDetails = (actionId: string) => {
// Open modal to show PO details // Open modal to show PO details in view mode
setSelectedPOId(actionId); setSelectedPOId(actionId);
setPOModalMode('view');
setIsPOModalOpen(true);
};
const handleModify = (actionId: string) => {
// Open modal to edit PO details
setSelectedPOId(actionId);
setPOModalMode('edit');
setIsPOModalOpen(true); setIsPOModalOpen(true);
}; };
@@ -273,6 +281,7 @@ export function NewDashboardPage() {
onApprove={handleApprove} onApprove={handleApprove}
onReject={handleReject} onReject={handleReject}
onViewDetails={handleViewDetails} onViewDetails={handleViewDetails}
onModify={handleModify}
tenantId={tenantId} tenantId={tenantId}
/> />
</div> </div>