Updated autos

This commit is contained in:
2024-07-02 16:53:33 -04:00
parent 4def44d82e
commit 72b19034ad
7 changed files with 345 additions and 76 deletions

View File

@@ -2,7 +2,7 @@
import Ticket from "../ticket/ticket.vue";
import TicketAuto from "../ticket/ticketauto.vue";
const payRoutes = [
@@ -11,6 +11,11 @@ const payRoutes = [
name: 'Ticket',
component: Ticket,
},
{
path: '/ticket/auto/:id',
name: 'TicketAuto',
component: TicketAuto,
},
]

View 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>