Added button and modal for sending estimates, functionality still to come.
This commit is contained in:
parent
60747a8766
commit
520e239741
@ -92,6 +92,9 @@
|
|||||||
:disabled="selectedItems.length === 0"
|
:disabled="selectedItems.length === 0"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button label="Send Estimate" @click="showSubmitEstimateModal = true"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address Search Modal -->
|
<!-- Address Search Modal -->
|
||||||
@ -187,6 +190,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -230,6 +254,7 @@ const selectedItems = ref([]);
|
|||||||
const showAddressModal = ref(false);
|
const showAddressModal = ref(false);
|
||||||
const showAddItemModal = ref(false);
|
const showAddItemModal = ref(false);
|
||||||
const showConfirmationModal = ref(false);
|
const showConfirmationModal = ref(false);
|
||||||
|
const showSubmitEstimateModal = ref(false);
|
||||||
const addressSearchResults = ref([]);
|
const addressSearchResults = ref([]);
|
||||||
const itemSearchTerm = ref("");
|
const itemSearchTerm = ref("");
|
||||||
|
|
||||||
@ -402,7 +427,7 @@ onMounted(async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error loading quotation items:", error);
|
console.error("Error loading quotation items:", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressQuery && isNew) {
|
if (addressQuery && isNew) {
|
||||||
// Creating new estimate - pre-fill address
|
// Creating new estimate - pre-fill address
|
||||||
await selectAddress(addressQuery);
|
await selectAddress(addressQuery);
|
||||||
@ -411,13 +436,13 @@ onMounted(async () => {
|
|||||||
try {
|
try {
|
||||||
estimate.value = await Api.getEstimateFromAddress(addressQuery);
|
estimate.value = await Api.getEstimateFromAddress(addressQuery);
|
||||||
console.log("DEBUG: Loaded estimate:", estimate.value);
|
console.log("DEBUG: Loaded estimate:", estimate.value);
|
||||||
|
|
||||||
if (estimate.value) {
|
if (estimate.value) {
|
||||||
await selectAddress(addressQuery);
|
await selectAddress(addressQuery);
|
||||||
// Set the contact from the estimate
|
// Set the contact from the estimate
|
||||||
formData.contact = estimate.value.partyName;
|
formData.contact = estimate.value.partyName;
|
||||||
selectedContact.value = contacts.value.find((c) => c.name === estimate.value.partyName) || null;
|
selectedContact.value = contacts.value.find((c) => c.name === estimate.value.partyName) || null;
|
||||||
|
|
||||||
// Populate items from the estimate
|
// Populate items from the estimate
|
||||||
if (estimate.value.items && estimate.value.items.length > 0) {
|
if (estimate.value.items && estimate.value.items.length > 0) {
|
||||||
selectedItems.value = estimate.value.items.map(item => {
|
selectedItems.value = estimate.value.items.map(item => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user