asdf
This commit is contained in:
@@ -85,6 +85,14 @@ const Applications = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchPropertyDetails = async (propertyId) => {
|
const fetchPropertyDetails = async (propertyId) => {
|
||||||
|
// Validate propertyId
|
||||||
|
if (!propertyId || isNaN(parseInt(propertyId))) {
|
||||||
|
console.error('Invalid property ID:', propertyId);
|
||||||
|
toast.error('Invalid property ID');
|
||||||
|
setSelectedPropertyDetails(null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Check cache first
|
// Check cache first
|
||||||
if (propertyCache[propertyId]) {
|
if (propertyCache[propertyId]) {
|
||||||
setSelectedPropertyDetails(propertyCache[propertyId]);
|
setSelectedPropertyDetails(propertyCache[propertyId]);
|
||||||
@@ -140,9 +148,17 @@ const Applications = () => {
|
|||||||
// Set the executing application and show the modal
|
// Set the executing application and show the modal
|
||||||
setExecutingApplication(application);
|
setExecutingApplication(application);
|
||||||
|
|
||||||
// Also fetch the property details if we don't have them
|
// Get the property ID from the application
|
||||||
if (!selectedPropertyDetails || selectedPropertyDetails.id !== application.property?.id) {
|
const propertyId = application.property?.id || application.section?.propertyId;
|
||||||
await fetchPropertyDetails(application.property?.id || application.section?.propertyId);
|
|
||||||
|
// Also fetch the property details if we don't have them and we have a valid property ID
|
||||||
|
if (!selectedPropertyDetails || (propertyId && selectedPropertyDetails.id !== propertyId)) {
|
||||||
|
if (propertyId) {
|
||||||
|
await fetchPropertyDetails(propertyId);
|
||||||
|
} else {
|
||||||
|
console.warn('No property ID found for application:', application);
|
||||||
|
toast.warning('No property associated with this application');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setShowExecutionModal(true);
|
setShowExecutionModal(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user