From 2c6077e0fa35253c512e84c06b401f99d800b6dd Mon Sep 17 00:00:00 2001 From: Edwin Eames Date: Mon, 29 Jul 2024 13:46:53 -0400 Subject: [PATCH] Fixed button automatic --- src/pages/automatic/home.vue | 35 ++++++++++++-- src/pages/customer/profile/home.vue | 47 +++++++++++-------- .../update_tickets/finalize_ticket.vue | 5 +- 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/src/pages/automatic/home.vue b/src/pages/automatic/home.vue index 6c43b2e..9bde514 100755 --- a/src/pages/automatic/home.vue +++ b/src/pages/automatic/home.vue @@ -62,14 +62,17 @@ - + {{ oil['estimated_gallons_left'] }} -
-
Waiting on Delivery
+
+ +
+
Waiting on Delivery
+
Pending Payment Confirmation
{{ oil['customer_full_name'] }} @@ -91,6 +94,7 @@ + @@ -108,6 +112,8 @@ import authHeader from '../../services/auth.header' import Header from '../../layouts/headers/headerauth.vue' import SideBar from '../../layouts/sidebar/sidebar.vue' import Footer from '../../layouts/footers/footer.vue' +import { notify } from "@kyvg/vue3-notification"; + export default defineComponent({ name: 'AutomaticHome', @@ -138,6 +144,7 @@ export default defineComponent({ created() { this.userStatus() this.getDriversList() + this.get_oil_orders() }, mounted() { this.get_oil_orders() @@ -163,6 +170,7 @@ export default defineComponent({ }, get_oil_orders() { + let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers'; axios({ method: 'get', @@ -170,6 +178,7 @@ export default defineComponent({ withCredentials: true, headers: authHeader(), }).then((response: any) => { + console.log("here") this.deliveries = response.data }) @@ -193,8 +202,7 @@ export default defineComponent({ get_auto_assignment() { - let path = import.meta.env.VITE_AUTO_URL + '/delivery/create/delivery'; - + let path = import.meta.env.VITE_AUTO_URL + '/delivery/create'; const selectedValues : any[] = []; for (const id in this.checkedMaterials) { @@ -213,6 +221,23 @@ export default defineComponent({ withCredentials: true, headers: authHeader(), }).then((response: any) => { + console.log(response.data.count) + + if (response.data.count > 0) { + notify({ + title: "Success", + text: "Added automatics to delivery", + type: "success", + }); + + } else { + notify({ + title: "Failure", + text: "Incorrect driver or no auto selection.", + type: "error", + }); + } + this.get_oil_orders() }) }, diff --git a/src/pages/customer/profile/home.vue b/src/pages/customer/profile/home.vue index 9b0ae4b..7cf0ac8 100755 --- a/src/pages/customer/profile/home.vue +++ b/src/pages/customer/profile/home.vue @@ -40,18 +40,20 @@
-
-
-
Automatic
+
Automatic
-
Will Call
+
Will Call
{{ customer.customer_first_name }} @@ -359,12 +361,7 @@ export default defineComponent({ this.getPage(this.delivery_page) }, computed: { - buttonText() { - return this.isTrue ? 'Become WillCall Customer' : 'Become Automatic Customer'; - }, - autoText() { - return this.isTrue? 'Automatic' : 'Will Call'; - } + }, watch: { $route() { @@ -402,7 +399,6 @@ export default defineComponent({ headers: authHeader(), }).then((response: any) => { this.automatic_status = response.data.status - console.log(this.automatic_status) }) }, @@ -415,24 +411,37 @@ export default defineComponent({ url: path, headers: authHeader(), }).then((response: any) => { - this.isTrue = !this.isTrue; this.automatic_response = response.data.status if (this.automatic_response == 1) { - this.$notify({ title: "Automatic Status", text: 'Customer is now Automatic Customer', type: 'Success' - }) - } else { - + }); + } else if (this.automatic_response == 2) { this.$notify({ title: "Automatic Status", - text: 'Customer is now will call', - type: 'Success' - }) + text: 'Customer does not have a main credit card. Can not make automatic.', + type: 'Error' + }); + } else if (this.automatic_response == 3) { + this.$notify({ + title: "Automatic Status", + text: 'Customer is now a Call in ', + type: 'Info' // Adjust type if needed + }); + } else { + this.$notify({ + title: "Automatic Status", + text: 'Customer is now Manual Customer', + type: 'Warning' // Adjust type if needed + }); } + + this.getCustomer(this.$route.params.id); + this.getCreditCards(this.$route.params.id) + this.getCreditCardsCount(this.$route.params.id) }) }, diff --git a/src/pages/delivery/update_tickets/finalize_ticket.vue b/src/pages/delivery/update_tickets/finalize_ticket.vue index b4d00e9..a594fc9 100755 --- a/src/pages/delivery/update_tickets/finalize_ticket.vue +++ b/src/pages/delivery/update_tickets/finalize_ticket.vue @@ -594,7 +594,6 @@ export default defineComponent({ type: "error", }); }); - }, editOilOrder(payload: { @@ -636,7 +635,7 @@ export default defineComponent({ gallons: string, delivery_id: string, }) { - let path = import.meta.env.VITE_AUTO_URL + "/delivery/add/delivery" + let path = import.meta.env.VITE_AUTO_URL + "/confirm/delivery" axios({ method: "put", url: path, @@ -651,7 +650,7 @@ export default defineComponent({ type: 'postive', title: 'top' }) - + this.$router.push({ name: "DeliveryHome" }); } else { notify({