Updated autos
This commit is contained in:
4
.env
4
.env
@@ -1,5 +1,5 @@
|
|||||||
VITE_BASE_URL="http://localhost:9511"
|
VITE_BASE_URL="http://localhost:9511"
|
||||||
VITE_AUTO_URL="http://localhost:9514"
|
|
||||||
VITE_MONEY_URL="http://localhost:9513"
|
|
||||||
VITE_PRINT_URL="http://localhost:9512"
|
VITE_PRINT_URL="http://localhost:9512"
|
||||||
|
VITE_MONEY_URL="http://localhost:9513"
|
||||||
|
VITE_AUTO_URL="http://localhost:9514"
|
||||||
VITE_COMPANY_ID = 1
|
VITE_COMPANY_ID = 1
|
||||||
@@ -23,9 +23,7 @@
|
|||||||
<router-link :to="{ name: 'customer' }">
|
<router-link :to="{ name: 'customer' }">
|
||||||
<div class=" hover:underline py-1">All Customers</div>
|
<div class=" hover:underline py-1">All Customers</div>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link :to="{ name: 'customerCreate' }">
|
|
||||||
<div class=" hover:underline py-1">Create Customer</div>
|
|
||||||
</router-link>
|
|
||||||
</li>
|
</li>
|
||||||
<div class="font-bold text-lg text-gray-500 pt-5">Delivery</div>
|
<div class="font-bold text-lg text-gray-500 pt-5">Delivery</div>
|
||||||
<li class="text-white">
|
<li class="text-white">
|
||||||
|
|||||||
@@ -19,79 +19,64 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex start text-2xl">Automatics </div>
|
<div class="flex start text-2xl mb-10">Automatics </div>
|
||||||
|
<div class="mb-10">
|
||||||
|
<div class="">Home Factor</div>
|
||||||
|
<div class="pl-10"> 1.00 = medium</div>
|
||||||
|
<div class="pl-10">1.50 = large</div>
|
||||||
|
<div class="pl-10">0.50 = small</div>
|
||||||
|
</div>
|
||||||
<div class="overflow-x-auto bg-neutral">
|
<div class="overflow-x-auto bg-neutral">
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<!-- head -->
|
<!-- head -->
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Ticket ID</th>
|
<th>Gallons Left</th>
|
||||||
<th>Due Date</th>
|
<th>Home Factor</th>
|
||||||
<th>Status</th>
|
|
||||||
<th>Town</th>
|
<th>Town</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Address</th>
|
<th>Address</th>
|
||||||
<th>Gallons</th>
|
<th>Last Fill</th>
|
||||||
<th>Date</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- row 1 -->
|
<!-- row 1 -->
|
||||||
<tr v-for="oil in deliveries" :key="oil['id']">
|
<tr v-for="oil in deliveries" :key="oil['id']">
|
||||||
<td>{{ oil['id'] }}</td>
|
<td>{{ oil['estimated_gallons_left'] }}</td>
|
||||||
<td>
|
<td>{{ oil['house_factor'] }}</td>
|
||||||
<div v-if="oil['delivery_status'] == 0">Waiting</div>
|
|
||||||
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
|
|
||||||
<div v-else-if="oil['delivery_status'] == 2">Out for Delivery</div>
|
|
||||||
<div v-else-if="oil['delivery_status'] == 3">Cancelled</div>
|
|
||||||
<div v-else-if="oil['delivery_status'] == 4">Partial Delivery</div>
|
|
||||||
<div v-else-if="oil['delivery_status'] == 5">Issue</div>
|
|
||||||
<div v-else-if="oil['delivery_status'] == 10">Finalized</div>
|
|
||||||
<div v-else></div>
|
|
||||||
</td>
|
|
||||||
<td>{{ oil['customer_town'] }}</td>
|
<td>{{ oil['customer_town'] }}</td>
|
||||||
<td>{{ oil['customer_name'] }}</td>
|
<td>{{ oil['customer_full_name'] }}</td>
|
||||||
<td>{{ oil['customer_address'] }}</td>
|
<td>{{ oil['customer_address'] }}</td>
|
||||||
<td>
|
<td>{{ oil['last_fill'] }} </td>
|
||||||
<div v-if="oil['customer_asked_for_fill'] == 1">Fill</div>
|
|
||||||
<div v-else> {{ oil['gallons_ordered'] }}</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ oil['expected_delivery_date'] }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div v-if="oil['automatic'] == 0">No</div>
|
|
||||||
<div v-else>Yes</div>
|
|
||||||
</td>
|
|
||||||
<td class="flex gap-5">
|
<td class="flex gap-5">
|
||||||
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
|
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
|
||||||
<button class="btn btn-accent btn-sm">Edit</button>
|
<button class="btn btn-accent btn-sm">
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
</router-link>
|
||||||
|
<router-link :to="{ name: 'TicketAuto', params: { id: oil['id'] } }">
|
||||||
|
<button class="btn btn-accent btn-sm">
|
||||||
|
Print
|
||||||
|
</button>
|
||||||
</router-link>
|
</router-link>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center" v-if="recordsLength > 9">
|
|
||||||
<pagination @paginate="getPage" :records="recordsLength" v-model="page" :per-page="perPage"
|
|
||||||
:options="options">
|
|
||||||
</pagination>
|
|
||||||
<div class="flex justify-center mb-10"> {{ recordsLength }} items Found</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<Footer/>
|
<Footer/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {defineComponent} from 'vue'
|
import {defineComponent} from 'vue'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import authHeader from '../../services/auth.header'
|
import authHeader from '../../services/auth.header'
|
||||||
import Header from '../../layouts/headers/headerauth.vue'
|
import Header from '../../layouts/headers/headerauth.vue'
|
||||||
import PaginationComp from '../../components/pagination.vue'
|
|
||||||
import SideBar from '../../layouts/sidebar/sidebar.vue'
|
import SideBar from '../../layouts/sidebar/sidebar.vue'
|
||||||
import Footer from '../../layouts/footers/footer.vue'
|
import Footer from '../../layouts/footers/footer.vue'
|
||||||
|
|
||||||
@@ -109,14 +94,7 @@ export default defineComponent({
|
|||||||
token: null,
|
token: null,
|
||||||
user: null,
|
user: null,
|
||||||
deliveries: [],
|
deliveries: [],
|
||||||
page: 1,
|
|
||||||
perPage: 50,
|
|
||||||
recordsLength: 0,
|
|
||||||
options: {
|
|
||||||
edgeNavigation: false,
|
|
||||||
format: false,
|
|
||||||
template: PaginationComp
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -124,15 +102,11 @@ export default defineComponent({
|
|||||||
this.userStatus()
|
this.userStatus()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getPage(this.page)
|
this.get_oil_orders()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPage: function (page: any) {
|
|
||||||
// we simulate an api call that fetch the records from a backend
|
|
||||||
this.deliveries = [];
|
|
||||||
this.get_oil_orders(page)
|
|
||||||
},
|
|
||||||
userStatus() {
|
userStatus() {
|
||||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||||
axios({
|
axios({
|
||||||
@@ -150,14 +124,20 @@ export default defineComponent({
|
|||||||
this.user = null
|
this.user = null
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
get_oil_orders(page: any) {
|
|
||||||
let path = import.meta.env.VITE_BASE_URL + '/delivery/all/' + page;
|
get_oil_orders() {
|
||||||
|
let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers';
|
||||||
|
console.log(path)
|
||||||
|
console.log("woop")
|
||||||
axios({
|
axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: path,
|
url: path,
|
||||||
|
withCredentials: true,
|
||||||
headers: authHeader(),
|
headers: authHeader(),
|
||||||
}).then((response: any) => {
|
}).then((response: any) => {
|
||||||
this.deliveries = response.data
|
this.deliveries = response.data.automatics
|
||||||
|
console.log("here")
|
||||||
|
console.log(this.deliveries)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,26 +34,36 @@
|
|||||||
Create Delivery
|
Create Delivery
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
|
|
||||||
<router-link :to="{ name: 'customerEdit', params: { id: customer.id } }"
|
<router-link :to="{ name: 'customerEdit', params: { id: customer.id } }"
|
||||||
class="btn-sm btn btn-accent">
|
class="btn-sm btn btn-accent">
|
||||||
Edit Customer
|
Edit Customer
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
|
<div v-if="automatic_status === 0">
|
||||||
|
<button :innerText="buttonText" v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-12 font-bold flex pb-5 text-lg">{{ customer.account_number }}</div>
|
<div v-else>
|
||||||
|
<button :innerText="buttonText" v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-span-12 font-bold flex pb-5 text-lg" v-if="automatic_status === 1" :innerText="autoText">Automatic</div>
|
||||||
|
|
||||||
|
<div class="col-span-12 font-bold flex pb-5 text-lg" :innerText="autoText" v-else>Will Call</div>
|
||||||
|
|
||||||
<div class="col-span-12 font-bold flex">
|
<div class="col-span-12 font-bold flex">
|
||||||
{{ customer.customer_first_name }}
|
{{ customer.customer_first_name }}
|
||||||
{{ customer.customer_last_name }}
|
{{ customer.customer_last_name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-12 font-bold flex">
|
<div class="col-span-12 font-bold flex">
|
||||||
|
|
||||||
{{ customer.customer_address }}
|
{{ customer.customer_address }}
|
||||||
<div v-if="customer.customer_apt != 'None'">
|
<div v-if="customer.customer_apt != 'None'">
|
||||||
{{ customer.customer_apt }}
|
{{ customer.customer_apt }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-span-12 font-bold flex">
|
<div class="col-span-12 font-bold flex">
|
||||||
<div class="pr-2">
|
<div class="pr-2">
|
||||||
{{ customer.customer_town }},
|
{{ customer.customer_town }},
|
||||||
@@ -296,6 +306,9 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
token: null,
|
token: null,
|
||||||
user: null,
|
user: null,
|
||||||
|
isTrue: true,
|
||||||
|
automatic_status: 0,
|
||||||
|
automatic_response: 0,
|
||||||
credit_cards: [
|
credit_cards: [
|
||||||
{
|
{
|
||||||
id: 0,
|
id: 0,
|
||||||
@@ -344,11 +357,15 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getPage(this.delivery_page)
|
this.getPage(this.delivery_page)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
buttonText() {
|
||||||
|
return this.isTrue ? 'Become Automatic Customer' : 'Become Willcall Customer';
|
||||||
|
},
|
||||||
|
autoText() {
|
||||||
|
return this.isTrue? 'Will Call' : 'Automatic ';
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route() {
|
$route() {
|
||||||
this.getCustomer(this.$route.params.id);
|
this.getCustomer(this.$route.params.id);
|
||||||
@@ -377,6 +394,45 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
userAutomaticStatus(userid: any) {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + '/customer/automatic/status/' + userid;
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: path,
|
||||||
|
headers: authHeader(),
|
||||||
|
}).then((response: any) => {
|
||||||
|
this.automatic_status = response.data.status
|
||||||
|
console.log(this.automatic_status)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
userAutomatic(userid: any) {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + '/customer/automatic/assign/' + userid;
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
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 {
|
||||||
|
this.$notify({
|
||||||
|
title: "Automatic Status",
|
||||||
|
text: 'Customer is now will call',
|
||||||
|
type: 'Success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
getCustomer(userid: any) {
|
getCustomer(userid: any) {
|
||||||
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
|
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
|
||||||
axios({
|
axios({
|
||||||
@@ -386,6 +442,7 @@ export default defineComponent({
|
|||||||
}).then((response: any) => {
|
}).then((response: any) => {
|
||||||
|
|
||||||
this.customer = response.data
|
this.customer = response.data
|
||||||
|
this.userAutomaticStatus(this.customer.id);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -77,17 +77,17 @@
|
|||||||
|
|
||||||
<td class="flex gap-5">
|
<td class="flex gap-5">
|
||||||
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
|
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
|
||||||
<button class="btn btn-accent">View</button>
|
<button class="btn btn-accent btn-sm">View</button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
|
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
|
||||||
<button class="btn btn-accent">Edit</button>
|
<button class="btn btn-accent btn-sm">Edit</button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
|
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
|
||||||
<button class="btn btn-accent btn-sm">
|
<button class="btn btn-accent btn-sm">
|
||||||
Print
|
Print
|
||||||
</button>
|
</button>
|
||||||
</router-link>
|
</router-link>
|
||||||
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
|
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent btn-sm">Delete</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import Ticket from "../ticket/ticket.vue";
|
import Ticket from "../ticket/ticket.vue";
|
||||||
|
import TicketAuto from "../ticket/ticketauto.vue";
|
||||||
|
|
||||||
|
|
||||||
const payRoutes = [
|
const payRoutes = [
|
||||||
@@ -11,6 +11,11 @@ const payRoutes = [
|
|||||||
name: 'Ticket',
|
name: 'Ticket',
|
||||||
component: Ticket,
|
component: Ticket,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/ticket/auto/:id',
|
||||||
|
name: 'TicketAuto',
|
||||||
|
component: TicketAuto,
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
229
src/pages/ticket/ticketauto.vue
Normal file
229
src/pages/ticket/ticketauto.vue
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div class=" absolute" id="captureRef">
|
||||||
|
<div class=" max-w-5xl text-black bg-white">
|
||||||
|
<div class="grid grid-cols-12">
|
||||||
|
<div class="col-span-8 ">
|
||||||
|
<div class="grid grid-cols-12 pb-4 pt-16 ">
|
||||||
|
<div class="col-span-2 pt-2 pl-4">#2 </div>
|
||||||
|
<div class="col-span-2 pt-2"></div>
|
||||||
|
<div class="col-span-2 pt-2"></div>
|
||||||
|
<div class="col-span-2 pt-2"></div>
|
||||||
|
<div class="col-span-1 pt-2 "></div>
|
||||||
|
<div class="col-span-3 pt-2 pl-6 ">{{ customer.customer_phone_number }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-12 pl-10 pb-10">
|
||||||
|
<div class="col-span-8">{{ customer.customer_first_name }} {{ customer.customer_last_name }}
|
||||||
|
</div>
|
||||||
|
<div class="col-span-4 pl-14">{{ customer.account_number }}</div>
|
||||||
|
<div class="col-span-12">{{ customer.customer_address }}</div>
|
||||||
|
<div class="col-span-3">
|
||||||
|
<div class="grid grid-cols-12">
|
||||||
|
<div class="col-span-5"> {{ customer.customer_town }}</div>
|
||||||
|
<div class="col-span-3">{{ customer.customer_state }}</div>
|
||||||
|
<div class="col-span-4"> {{ customer.customer_zip }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-12 pl-10 pb-10 pt-5">
|
||||||
|
<div class="col-span-12 text-lg">Automatic</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-12 pl-10">
|
||||||
|
<div class="col-span-6" v-for="past_delivery in past_deliveries1">
|
||||||
|
<div class="">{{ past_delivery.when_delivered }} - {{ past_delivery.gallons_delivered }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-span-6" v-for="past_delivery2 in past_deliveries2">
|
||||||
|
<div class="">{{ past_delivery2.when_delivered }} - {{ past_delivery2.gallons_delivered }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-span-4 ">
|
||||||
|
<div class="grid grid-cols-12 pt-16">
|
||||||
|
<div class="col-span-12 h-7 pl-10 pt-2"></div>
|
||||||
|
<div class="col-span-12 h-7 pl-10 pt-5"></div>
|
||||||
|
<div class="col-span-12 h-7 pl-10 pt-8">FILL</div>
|
||||||
|
<div class="col-span-12 h-7 pl-10 pt-10"> </div>
|
||||||
|
<div class="col-span-12 h-7 pl-10 pt-10"> </div>
|
||||||
|
<div class="col-span-12 h-7 pt-6"></div>
|
||||||
|
<div class="col-span-12 h-7"></div>
|
||||||
|
<div class="col-span-12 h-7 pl-8"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
|
||||||
|
import { defineComponent } from 'vue'
|
||||||
|
import axios from 'axios'
|
||||||
|
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: 'TicketAuto',
|
||||||
|
|
||||||
|
components: {
|
||||||
|
Header,
|
||||||
|
SideBar,
|
||||||
|
Footer,
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loaded: false,
|
||||||
|
user: {
|
||||||
|
user_id: 0,
|
||||||
|
},
|
||||||
|
past_deliveries1: [
|
||||||
|
{
|
||||||
|
gallons_delivered: 0,
|
||||||
|
when_delivered: '',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
past_deliveries2: [
|
||||||
|
{
|
||||||
|
gallons_delivered: 0,
|
||||||
|
when_delivered: '',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
customer: {
|
||||||
|
id: 0,
|
||||||
|
user_id: 0,
|
||||||
|
customer_first_name: '',
|
||||||
|
customer_last_name: '',
|
||||||
|
customer_town: '',
|
||||||
|
customer_address: '',
|
||||||
|
customer_state: 0,
|
||||||
|
customer_zip: '',
|
||||||
|
customer_apt: '',
|
||||||
|
customer_home_type: 0,
|
||||||
|
customer_phone_number: '',
|
||||||
|
account_number: '',
|
||||||
|
},
|
||||||
|
automatic: {
|
||||||
|
id: 0,
|
||||||
|
customer_id: 0,
|
||||||
|
customer_full_name: '',
|
||||||
|
last_fill: '',
|
||||||
|
last_updated: '',
|
||||||
|
estimated_gallons_left: 0,
|
||||||
|
estimated_gallons_left_prev_day: 0,
|
||||||
|
tank_height: '',
|
||||||
|
tank_size: '',
|
||||||
|
house_factor: '',
|
||||||
|
},
|
||||||
|
|
||||||
|
priceprime: 0,
|
||||||
|
pricesameday: 0,
|
||||||
|
total_amount: 0,
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getAutomaticOrder(this.$route.params.id);
|
||||||
|
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
$route() {
|
||||||
|
this.getAutomaticOrder(this.$route.params.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
getAutomaticOrder(delivery_id: any) {
|
||||||
|
let path = import.meta.env.VITE_AUTO_URL + "/delivery/" + delivery_id;
|
||||||
|
axios({
|
||||||
|
method: "get",
|
||||||
|
url: path,
|
||||||
|
withCredentials: true,
|
||||||
|
})
|
||||||
|
.then((response: any) => {
|
||||||
|
this.automatic = response.data.automatic;
|
||||||
|
this.getCustomer(response.data.automatic.customer_id);
|
||||||
|
this.sumdelivery(this.$route.params.id);
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
notify({
|
||||||
|
title: "Error",
|
||||||
|
text: "Could not get oil order",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
sumdelivery(delivery_id: any) {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + "/delivery/total/" + delivery_id;
|
||||||
|
axios({
|
||||||
|
method: "get",
|
||||||
|
url: path,
|
||||||
|
withCredentials: true,
|
||||||
|
})
|
||||||
|
.then((response: any) => {
|
||||||
|
if (response.data.ok) {
|
||||||
|
this.priceprime = response.data.priceprime;
|
||||||
|
this.pricesameday = response.data.pricesameday;
|
||||||
|
this.total_amount = response.data.total_amount;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
notify({
|
||||||
|
title: "Error",
|
||||||
|
text: "Could not get oil pricing",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getCustomer(userid: any) {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: path,
|
||||||
|
headers: authHeader(),
|
||||||
|
}).then((response: any) => {
|
||||||
|
this.customer = response.data
|
||||||
|
this.getPastDeliveries1(this.customer.id)
|
||||||
|
this.getPastDeliveries2(this.customer.id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getPastDeliveries1(userid: any) {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + '/delivery/past1/' + userid;
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: path,
|
||||||
|
headers: authHeader(),
|
||||||
|
}).then((response: any) => {
|
||||||
|
this.past_deliveries1 = response.data
|
||||||
|
console.log(this.past_deliveries1);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getPastDeliveries2(userid: any) {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + '/delivery/past2/' + userid;
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: path,
|
||||||
|
headers: authHeader(),
|
||||||
|
}).then((response: any) => {
|
||||||
|
this.past_deliveries2 = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user