fixed profile

This commit is contained in:
2025-09-06 14:55:02 -04:00
parent e74f5510f0
commit 6978ed30e1
3 changed files with 16 additions and 4 deletions

View File

@@ -154,6 +154,9 @@
</div> </div>
</div> </div>
</div> </div>
<Footer /> <Footer />
</template> </template>
@@ -343,7 +346,7 @@ export default defineComponent({
}) })
.then((response: any) => { .then((response: any) => {
if (response.data.ok) { if (response.data.ok) {
this.$router.push({ name: "customerProfile", params: { id: this.customer.id } }); this.$router.push({ name: "customerProfile", params: { id: this.customer.id }, query: { success: 'true' } });
} else if (response.data.error) { } else if (response.data.error) {
// Handle specific errors if needed // Handle specific errors if needed
this.$router.push("/"); this.$router.push("/");

View File

@@ -52,6 +52,7 @@
class="xl:col-span-5" class="xl:col-span-5"
:customer="customer" :customer="customer"
:automatic_status="automatic_status" :automatic_status="automatic_status"
:customer_description="customer_description.description"
@toggle-automatic="userAutomatic" @toggle-automatic="userAutomatic"
/> />
</div> </div>
@@ -271,7 +272,12 @@ export default defineComponent({
this.getCustomer(this.$route.params.id); this.getCustomer(this.$route.params.id);
}, },
mounted() { mounted() {
// getPage is now called from within getCustomer, so this can be removed if it's redundant // Check for success query parameter and show notification
if (this.$route.query.success === 'true') {
this.$notify({ title: "Success", text: "Customer edited successfully!", type: "success" });
// Clean up the URL by removing the query parameter
this.$router.replace({ name: this.$route.name, params: this.$route.params, query: {} });
}
}, },
watch: { watch: {
'$route.params.id'(newId) { '$route.params.id'(newId) {

View File

@@ -67,6 +67,8 @@
<p>{{ customer.customer_town }}, {{ stateName(customer.customer_state) }} {{ customer.customer_zip }}</p> <p>{{ customer.customer_town }}, {{ stateName(customer.customer_state) }} {{ customer.customer_zip }}</p>
<p class="pt-2">{{ customer.customer_phone_number }}</p> <p class="pt-2">{{ customer.customer_phone_number }}</p>
<p><span class="badge badge-outline badge-sm">{{ homeTypeName(customer.customer_home_type) }}</span></p> <p><span class="badge badge-outline badge-sm">{{ homeTypeName(customer.customer_home_type) }}</span></p>
<hr class="my-2" v-if="customer_description">
<p v-if="customer_description" class="text-sm">{{ customer_description }}</p>
</div> </div>
</div> </div>
</div> </div>
@@ -91,6 +93,7 @@ interface Customer {
interface Props { interface Props {
customer: Customer; customer: Customer;
automatic_status: number; automatic_status: number;
customer_description?: string;
} }
defineProps<Props>(); defineProps<Props>();