update estimate to have remarks

This commit is contained in:
Casey 2026-02-13 14:26:47 -06:00
parent caa4bc2dca
commit 49617c39c4
2 changed files with 19 additions and 3 deletions

View file

@ -462,6 +462,7 @@ def upsert_estimate(data):
estimate.requires_half_payment = data.get("requires_half_payment", 0) estimate.requires_half_payment = data.get("requires_half_payment", 0)
estimate.custom_project_template = project_template estimate.custom_project_template = project_template
estimate.custom_quotation_template = data.get("quotation_template", None) estimate.custom_quotation_template = data.get("quotation_template", None)
estimate.remarks = data.get("remarks", "")
# estimate.company = data.get("company") # estimate.company = data.get("company")
# estimate.contact_email = data.get("contact_email") # estimate.contact_email = data.get("contact_email")
# estimate.quotation_to = client_doctype # estimate.quotation_to = client_doctype
@ -515,7 +516,8 @@ def upsert_estimate(data):
"letter_head": data.get("company"), "letter_head": data.get("company"),
"custom_project_template": data.get("project_template", None), "custom_project_template": data.get("project_template", None),
"custom_quotation_template": data.get("quotation_template", None), "custom_quotation_template": data.get("quotation_template", None),
"from_onsite_meeting": data.get("from_onsite_meeting", None) "from_onsite_meeting": data.get("from_onsite_meeting", None),
"remarks": data.get("remarks", "")
}) })
for item in data.get("items", []): for item in data.get("items", []):
item = json.loads(item) if isinstance(item, str) else item item = json.loads(item) if isinstance(item, str) else item
@ -534,7 +536,7 @@ def upsert_estimate(data):
# ClientService.append_link(data.get("customer"), "quotations", "quotation", new_estimate.name) # ClientService.append_link(data.get("customer"), "quotations", "quotation", new_estimate.name)
print("DEBUG: New estimate created with name:", new_estimate.name) print("DEBUG: New estimate created with name:", new_estimate.name)
dict = new_estimate.as_dict() dict = new_estimate.as_dict()
dict["items"] = [{**ItemService.get_full_dict(item.item_code), **item} for item in new_estimate.items] dict["items"] = [{**item.as_dict(), **ItemService.get_full_dict(item.item_code)} for item in new_estimate.items]
return build_success_response(dict) return build_success_response(dict)
except Exception as e: except Exception as e:
print(f"DEBUG: Error in upsert_estimate: {str(e)}") print(f"DEBUG: Error in upsert_estimate: {str(e)}")

View file

@ -90,7 +90,17 @@
<span>Loading available items...</span> <span>Loading available items...</span>
</div> </div>
</div> </div>
<div class="remarks-section">
<label for="remarks" class="field-label">Remarks</label>
<Textarea
id="remarks"
v-model="formData.remarks"
placeholder="Additional notes or instructions for the estimate"
:disabled="!isEditable"
:rows="6"
fluid
/>
</div>
<!-- Items Section --> <!-- Items Section -->
<div class="items-section"> <div class="items-section">
<div class="items-header"> <div class="items-header">
@ -422,6 +432,7 @@ import Button from "primevue/button";
import Select from "primevue/select"; import Select from "primevue/select";
import Tooltip from "primevue/tooltip"; import Tooltip from "primevue/tooltip";
import Drawer from "primevue/drawer"; import Drawer from "primevue/drawer";
import Textarea from "primevue/textarea";
import Api from "../../api"; import Api from "../../api";
import DataUtils from "../../utils"; import DataUtils from "../../utils";
import { useLoadingStore } from "../../stores/loading"; import { useLoadingStore } from "../../stores/loading";
@ -784,6 +795,7 @@ const saveDraft = async () => {
requiresHalfPayment: formData.requiresHalfPayment, requiresHalfPayment: formData.requiresHalfPayment,
projectTemplate: formData.projectTemplate, projectTemplate: formData.projectTemplate,
fromOnsiteMeeting: formData.fromOnsiteMeeting, fromOnsiteMeeting: formData.fromOnsiteMeeting,
remarks: formData.remarks,
company: company.currentCompany company: company.currentCompany
}; };
estimate.value = await Api.createEstimate(data); estimate.value = await Api.createEstimate(data);
@ -1015,6 +1027,7 @@ watch(
}); });
} }
formData.requiresHalfPayment = Boolean(estimate.value.requiresHalfPayment || estimate.value.custom_requires_half_payment); formData.requiresHalfPayment = Boolean(estimate.value.requiresHalfPayment || estimate.value.custom_requires_half_payment);
formData.remarks = estimate.value.remarks;
// If estimate has fromOnsiteMeeting, fetch bid meeting // If estimate has fromOnsiteMeeting, fetch bid meeting
if (estimate.value.fromOnsiteMeeting) { if (estimate.value.fromOnsiteMeeting) {
try { try {
@ -1172,6 +1185,7 @@ onMounted(async () => {
}); });
} }
formData.requiresHalfPayment = Boolean(estimate.value.requiresHalfPayment || estimate.value.custom_requires_half_payment); formData.requiresHalfPayment = Boolean(estimate.value.requiresHalfPayment || estimate.value.custom_requires_half_payment);
formData.remarks = estimate.value.remarks;
// If estimate has fromOnsiteMeeting, fetch bid meeting // If estimate has fromOnsiteMeeting, fetch bid meeting
if (estimate.value.fromOnsiteMeeting) { if (estimate.value.fromOnsiteMeeting) {
try { try {