Fixed an issue with responsive UI related to setting the customer response.

This commit is contained in:
rocketdebris 2025-12-22 17:28:39 -05:00
parent d30fc77527
commit d4240e0cc3
2 changed files with 17 additions and 8 deletions

View file

@ -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)

View file

@ -2,7 +2,9 @@
<div class="estimate-page">
<h2>{{ isNew ? 'Create Estimate' : 'View Estimate' }}</h2>
<div v-if="!isNew && estimate" class="page-actions">
<Button label="Estimate Response" @click="showResponseModal = true" />
<div v-if="estimate && estimate.customSent === 1">
<Button label="Estimate Response" @click="showResponseModal = true" />
</div>
<Button label="Duplicate" icon="pi pi-copy" @click="duplicateEstimate" />
</div>
@ -108,8 +110,8 @@
</div>
<div v-if="estimate && estimate.customSent === 1" class="response-status">
<h4>Customer Response:</h4>
<span :class="getResponseClass(estimate.customResponse)">
{{ getResponseText(estimate.customResponse) }}
<span :class="getResponseClass(getResponseText(estimateResponse))">
{{ getResponseText(estimateResponse) }}
</span>
</div>
</div>
@ -122,7 +124,7 @@
:options="{ showActions: false }"
>
<template #title>Set Response</template>
<Select v-model="estimateResponse" :options="responses" placeholder="Select Response"/>
<Select v-model="estimateResponseSelection" :options="responses" placeholder="Select Response"/>
<Button label="Submit" @click="submitResponse"/>
</Modal>
@ -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);