asdf
This commit is contained in:
@@ -40,18 +40,18 @@ const ApplicationExecutionModal = ({ application, propertyDetails, onClose, onCo
|
|||||||
const planDetails = planResponse.data.data.plan;
|
const planDetails = planResponse.data.data.plan;
|
||||||
|
|
||||||
console.log('Fetched plan details:', planDetails);
|
console.log('Fetched plan details:', planDetails);
|
||||||
console.log('Plan details areas:', planDetails.areas);
|
console.log('Plan details sections:', planDetails.sections);
|
||||||
|
|
||||||
if (planDetails.areas && planDetails.areas.length > 0) {
|
if (planDetails.sections && planDetails.sections.length > 0) {
|
||||||
setSections(planDetails.areas);
|
setSections(planDetails.sections);
|
||||||
|
|
||||||
// Calculate center from section coordinates
|
// Calculate center from section coordinates
|
||||||
let totalLat = 0;
|
let totalLat = 0;
|
||||||
let totalLng = 0;
|
let totalLng = 0;
|
||||||
let pointCount = 0;
|
let pointCount = 0;
|
||||||
|
|
||||||
planDetails.areas.forEach(area => {
|
planDetails.sections.forEach(section => {
|
||||||
let polygonData = area.polygonData;
|
let polygonData = section.polygonData;
|
||||||
if (typeof polygonData === 'string') {
|
if (typeof polygonData === 'string') {
|
||||||
try {
|
try {
|
||||||
polygonData = JSON.parse(polygonData);
|
polygonData = JSON.parse(polygonData);
|
||||||
@@ -78,7 +78,7 @@ const ApplicationExecutionModal = ({ application, propertyDetails, onClose, onCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: If we have property details, use those sections
|
// Fallback: If we have property details, use those sections
|
||||||
if ((!planDetails.areas || planDetails.areas.length === 0) && propertyDetails?.sections) {
|
if ((!planDetails.sections || planDetails.sections.length === 0) && propertyDetails?.sections) {
|
||||||
const applicationSectionIds = application.sections?.map(s => s.id) || [];
|
const applicationSectionIds = application.sections?.map(s => s.id) || [];
|
||||||
const relevantSections = propertyDetails.sections.filter(section =>
|
const relevantSections = propertyDetails.sections.filter(section =>
|
||||||
applicationSectionIds.includes(section.id)
|
applicationSectionIds.includes(section.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user