Added button and modal for sending estimates, functionality still to come.

This commit is contained in:
rocketdebris 2025-12-02 16:01:52 -05:00
parent 60747a8766
commit 520e239741

View File

@ -92,6 +92,9 @@
:disabled="selectedItems.length === 0"
/>
</div>
<div>
<Button label="Send Estimate" @click="showSubmitEstimateModal = true"/>
</div>
</div>
<!-- Address Search Modal -->
@ -187,6 +190,27 @@
</div>
</div>
</Modal>
<!-- Submit Estimate Modal -->
<Modal
:visible="showSubmitEstimateModal"
@update:visible="showSubmitEstimateModal = $event"
@close="showSubmitEstimateModal = false"
:options="{ showActions: false }"
>
<p><strong>Submit Estimate and Email {{ selectedContact.firstName }} {{
selectedContact.lastName}}?</strong></p>
<p>This cannot be undone, please make sure all information is correct.</p>
<div class="confirmation-buttons">
<Button
label="No"
@click="showSubmitEstimateModal = false"
severity="secondary"
/>
<Button label="Yes" @click="sendEstimate" />
</div>
</Modal>
</div>
</template>
@ -230,6 +254,7 @@ const selectedItems = ref([]);
const showAddressModal = ref(false);
const showAddItemModal = ref(false);
const showConfirmationModal = ref(false);
const showSubmitEstimateModal = ref(false);
const addressSearchResults = ref([]);
const itemSearchTerm = ref("");
@ -402,7 +427,7 @@ onMounted(async () => {
} catch (error) {
console.error("Error loading quotation items:", error);
}
if (addressQuery && isNew) {
// Creating new estimate - pre-fill address
await selectAddress(addressQuery);
@ -411,13 +436,13 @@ onMounted(async () => {
try {
estimate.value = await Api.getEstimateFromAddress(addressQuery);
console.log("DEBUG: Loaded estimate:", estimate.value);
if (estimate.value) {
await selectAddress(addressQuery);
// Set the contact from the estimate
formData.contact = estimate.value.partyName;
selectedContact.value = contacts.value.find((c) => c.name === estimate.value.partyName) || null;
// Populate items from the estimate
if (estimate.value.items && estimate.value.items.length > 0) {
selectedItems.value = estimate.value.items.map(item => {