diff --git a/custom_ui/api/db/estimates.py b/custom_ui/api/db/estimates.py
index ab1a9af..0368422 100644
--- a/custom_ui/api/db/estimates.py
+++ b/custom_ui/api/db/estimates.py
@@ -176,13 +176,14 @@ def manual_response(name, response):
new_status = "Estimate Accepted" if accepted else "Lost"
estimate.custom_response = response
- estimate.custom_current_status = new_status
- estimate.status = "Ordered" if accepted else "Closed"
+ # estimate.custom_current_status = new_status
+ # estimate.status = "Ordered" if accepted else "Closed"
estimate.flags.ignore_permissions = True
print("DEBUG: Updating estimate with response:", response, "and status:", new_status)
estimate.save()
+ return build_success_response(estimate.as_dict())
except Exception as e:
- return e
+ return build_error_response(str(e), 500)
@frappe.whitelist(allow_guest=True)
diff --git a/frontend/src/components/pages/Estimate.vue b/frontend/src/components/pages/Estimate.vue
index e6b1275..9048950 100644
--- a/frontend/src/components/pages/Estimate.vue
+++ b/frontend/src/components/pages/Estimate.vue
@@ -2,7 +2,9 @@
{{ isNew ? 'Create Estimate' : 'View Estimate' }}
@@ -108,8 +110,8 @@
Customer Response:
-
- {{ getResponseText(estimate.customResponse) }}
+
+ {{ getResponseText(estimateResponse) }}
@@ -122,7 +124,7 @@
:options="{ showActions: false }"
>
Set Response
-
+
@@ -273,7 +275,9 @@ const formData = reactive({
const selectedAddress = ref(null);
const selectedContact = ref(null);
+const estimateResponseClass = ref(null);
const estimateResponse = ref(null);
+const estimateResponseSelection = ref(null);
const contacts = ref([]);
const contactOptions = ref([]);
const quotationItems = ref([]);
@@ -412,7 +416,9 @@ const saveDraft = async () => {
};
const submitResponse = () => {
- Api.updateEstimateResponse(estimate.value.name, estimateResponse.value, false);
+ Api.updateEstimateResponse(estimate.value.name, estimateResponseSelection.value, false);
+ estimateResponse.value = estimateResponseSelection.value;
+ showResponseModal.value = false;
}
const duplicateEstimate = () => {
@@ -602,6 +608,8 @@ onMounted(async () => {
});
}
formData.requiresHalfPayment = estimate.value.custom_requires_half_payment || false;
+ estimateResponse.value = estimate.value.customResponse;
+ estimateResponseSelection.value = estimate.value.customResponse;
}
} catch (error) {
console.error("Error loading estimate:", error);