Ticket good printing

This commit is contained in:
2024-06-25 17:58:18 -04:00
parent 52a02c7595
commit 4def44d82e
15 changed files with 963 additions and 429 deletions

View File

@@ -1,55 +1,57 @@
<template>
<div class=" absolute" id="page">
<div class="p-10 max-w-5xl bg-white text-black">
<div class=" absolute" id="captureRef">
<div class=" max-w-5xl text-black bg-white">
<div class="grid grid-cols-12">
<div class="col-span-9">
<div class="grid grid-cols-12 pb-10">
<div class="col-span-2">#2 Heating</div>
<div class="col-span-2"></div>
<div class="col-span-2">0</div>
<div class="col-span-2">275</div>
<div class="col-span-2">{{ customer.customer_phone_number }}</div>
<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-5 pb-10">
<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">{{ customer.account_number }}</div>
<div class="col-span-12">{{ customer.customer_address }} {{ customer.customer_apt }}</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-5 pb-10">
<div class="grid grid-cols-12 pl-10 pb-10 pt-5">
<div class="col-span-12 pb-5">{{ delivery.dispatcher_notes }}</div>
<div class="col-span-12" v-if="delivery.payment_type == 0">CASH</div>
<div class="col-span-12" v-else-if="delivery.payment_type == 1">Credit Card</div>
<div class="col-span-12" v-else-if="delivery.payment_type == 2">Credit Card/Cash</div>
<div class="col-span-12 text-lg" v-if="delivery.payment_type == 0">CASH</div>
<div class="col-span-12 text-lg" v-else-if="delivery.payment_type == 1">Credit Card</div>
<div class="col-span-12 text-lg" v-else-if="delivery.payment_type == 2">Credit Card/Cash</div>
<div class="col-span-12" v-else></div>
</div>
<div class="grid grid-cols-12">
<div class="col-span-6 flex" v-for="past_delivery in past_deliveries">
<div>{{ past_delivery.when_delivered }} - {{ past_delivery.gallons_delivered }}</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-3">
<div class="grid grid-cols-12">
<div class="col-span-12 h-7">{{ delivery.when_ordered }}</div>
<div class="col-span-12 h-7 ">{{ delivery.expected_delivery_date }}</div>
<div class="col-span-12 h-7 "></div>
<div class="col-span-12 h-7">{{ delivery.customer_price }}</div>
<div class="col-span-12 h-7">{{ delivery.when_ordered }}</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">{{ delivery.when_ordered }}</div>
<div class="col-span-12 h-7 pl-10 pt-5">{{ delivery.expected_delivery_date }}</div>
<div class="col-span-12 h-7 pl-10 pt-8">{{ delivery.gallons_ordered }}</div>
<div class="col-span-12 h-7 pl-10 pt-10">{{ delivery.customer_price }} </div>
<div class="col-span-12 h-7 pl-10 pt-10">{{ total_amount }} </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"></div>
<div class="col-span-12 h-7 ">{{ delivery.driver_employee_id }}</div>
<div class="col-span-12 h-7 pl-8"></div>
</div>
</div>
</div>
@@ -66,9 +68,7 @@ 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 useValidate from "@vuelidate/core";
import { notify } from "@kyvg/vue3-notification"
import { minLength, required } from "@vuelidate/validators";
export default defineComponent({
name: 'Ticket',
@@ -82,12 +82,17 @@ export default defineComponent({
data() {
return {
v$: useValidate(),
loaded: false,
user: {
user_id: 0,
},
past_deliveries: [
past_deliveries1: [
{
gallons_delivered: 0,
when_delivered: '',
}
],
past_deliveries2: [
{
gallons_delivered: 0,
when_delivered: '',
@@ -137,50 +142,29 @@ export default defineComponent({
customer_phone_number: '',
account_number: '',
},
priceprime: 0,
pricesameday: 0,
total_amount: 0,
}
},
validations() {
return {
CreateOilOrderForm: {
basicInfo: {
gallons_ordered: { required, minLength: minLength(1) },
expected_delivery_date: { required },
},
},
};
},
created() {
this.userStatus()
this.getOilOrder(this.$route.params.id)
this.sumdelivery(this.$route.params.id);
},
watch: {
$route() {
this.getOilOrder(this.$route.params.id)
this.sumdelivery(this.$route.params.id);
},
},
mounted() {
this.getOilOrder(this.$route.params.id)
},
methods: {
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
method: 'get',
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
},
getOilOrder(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/" + delivery_id;
axios({
@@ -191,6 +175,7 @@ export default defineComponent({
.then((response: any) => {
this.delivery = response.data;
this.getCustomer(this.delivery.customer_id)
})
.catch(() => {
notify({
@@ -201,6 +186,29 @@ export default defineComponent({
});
},
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({
@@ -209,23 +217,32 @@ export default defineComponent({
headers: authHeader(),
}).then((response: any) => {
this.customer = response.data
this.getPastDeliveries(this.customer.id)
this.getPastDeliveries1(this.customer.id)
this.getPastDeliveries2(this.customer.id)
})
},
getPastDeliveries(userid: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/past/' + userid;
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_deliveries = response.data
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>
<style scoped></style>