applications updates
This commit is contained in:
@@ -75,7 +75,7 @@ router.get('/plans', async (req, res, next) => {
|
||||
STRING_AGG(DISTINCT ls.name, ', ') as section_names,
|
||||
SUM(DISTINCT ls.area) as total_section_area,
|
||||
COUNT(DISTINCT aps.lawn_section_id) as section_count,
|
||||
p.name as property_name, p.address as property_address,
|
||||
p.id as property_id, p.name as property_name, p.address as property_address,
|
||||
ue.custom_name as equipment_name, et.name as equipment_type
|
||||
FROM application_plans ap
|
||||
JOIN application_plan_sections aps ON ap.id = aps.plan_id
|
||||
@@ -84,7 +84,7 @@ router.get('/plans', async (req, res, next) => {
|
||||
LEFT JOIN user_equipment ue ON ap.equipment_id = ue.id
|
||||
LEFT JOIN equipment_types et ON ue.equipment_type_id = et.id
|
||||
WHERE ${whereClause}
|
||||
GROUP BY ap.id, p.name, p.address, ue.custom_name, et.name
|
||||
GROUP BY ap.id, p.id, p.name, p.address, ue.custom_name, et.name
|
||||
ORDER BY ap.planned_date DESC, ap.created_at DESC`,
|
||||
queryParams
|
||||
);
|
||||
@@ -204,6 +204,7 @@ router.get('/plans', async (req, res, next) => {
|
||||
sectionNames: plan.section_names, // Multiple section names comma-separated
|
||||
sectionCount: parseInt(plan.section_count),
|
||||
totalSectionArea: parseFloat(plan.total_section_area),
|
||||
propertyId: plan.property_id, // Add property ID for frontend to use
|
||||
propertyName: plan.property_name,
|
||||
propertyAddress: plan.property_address,
|
||||
equipmentName: plan.equipment_name || plan.equipment_type,
|
||||
|
||||
@@ -168,7 +168,7 @@ const Applications = () => {
|
||||
setExecutingApplication(application);
|
||||
|
||||
// Get the property ID from the application
|
||||
const propertyId = application.property?.id || application.section?.propertyId;
|
||||
const propertyId = application.propertyId;
|
||||
|
||||
// Try to fetch property details if we have a valid property ID
|
||||
if (propertyId && (!selectedPropertyDetails || selectedPropertyDetails.id !== propertyId)) {
|
||||
@@ -192,7 +192,7 @@ const Applications = () => {
|
||||
setViewingApplication(application);
|
||||
|
||||
// Get the property ID from the application
|
||||
const propertyId = application.property?.id || application.section?.propertyId;
|
||||
const propertyId = application.propertyId;
|
||||
|
||||
// Try to fetch property details if we have a valid property ID
|
||||
if (propertyId && (!selectedPropertyDetails || selectedPropertyDetails.id !== propertyId)) {
|
||||
|
||||
Reference in New Issue
Block a user