Added totals to delivery

This commit is contained in:
2026-01-05 09:14:13 -05:00
parent 65cfd0c463
commit 68f5b6eafc
3 changed files with 97 additions and 4 deletions

View File

@@ -25,6 +25,18 @@
<div class="divider"></div> <div class="divider"></div>
<!-- Total Gallons -->
<div v-if="grand_total > 0 || totals.length > 0" class="mb-4">
<div v-if="grand_total > 0" class="mb-2">
<span class="badge badge-accent">Total: {{ grand_total }}</span>
</div>
<div class="flex flex-wrap gap-2">
<span v-for="total in totals" :key="total.town" class="badge badge-primary">
{{ total.town }}: {{ total.gallons }}
</span>
</div>
</div>
<!-- DESKTOP VIEW: Table --> <!-- DESKTOP VIEW: Table -->
<div class="overflow-x-auto hidden xl:block"> <div class="overflow-x-auto hidden xl:block">
<table class="table w-full"> <table class="table w-full">
@@ -176,6 +188,8 @@ export default defineComponent({
token: null, token: null,
user: null, user: null,
deliveries: [] as any[], deliveries: [] as any[],
totals: [] as any[],
grand_total: 0,
page: 1, page: 1,
perPage: 50, perPage: 50,
recordsLength: 0, recordsLength: 0,
@@ -191,6 +205,7 @@ export default defineComponent({
}, },
mounted() { mounted() {
this.getPage(this.page) this.getPage(this.page)
this.get_totals()
}, },
methods: { methods: {
getPage: function (page: any) { getPage: function (page: any) {
@@ -230,6 +245,22 @@ export default defineComponent({
}) })
}, },
get_totals() {
let path = import.meta.env.VITE_BASE_URL + '/deliverystatus/today-totals';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.totals = response.data.totals || []
this.grand_total = response.data.grand_total || 0
}).catch((error: any) => {
console.error('Error fetching totals:', error);
this.totals = []
this.grand_total = 0
})
},
deleteCall(delivery_id: any) { deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id; let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({ axios({

View File

@@ -19,6 +19,18 @@
<div class="divider"></div> <div class="divider"></div>
<!-- Total Gallons -->
<div v-if="grand_total > 0 || totals.length > 0" class="mb-4">
<div v-if="grand_total > 0" class="mb-2">
<span class="badge badge-accent">Total: {{ grand_total }}</span>
</div>
<div class="flex flex-wrap gap-2">
<span v-for="total in totals" :key="total.town" class="badge badge-primary">
{{ total.town }}: {{ total.gallons }}
</span>
</div>
</div>
<!-- DESKTOP VIEW: Table --> <!-- DESKTOP VIEW: Table -->
<div class="overflow-x-auto hidden xl:block"> <div class="overflow-x-auto hidden xl:block">
<table class="table w-full"> <table class="table w-full">
@@ -169,6 +181,8 @@ export default defineComponent({
token: null, token: null,
user: null, user: null,
deliveries: [] as any[], deliveries: [] as any[],
totals: [] as any[],
grand_total: 0,
page: 1, page: 1,
perPage: 50, perPage: 50,
recordsLength: 0, recordsLength: 0,
@@ -184,6 +198,7 @@ export default defineComponent({
}, },
mounted() { mounted() {
this.getPage(this.page) this.getPage(this.page)
this.get_totals()
}, },
methods: { methods: {
getPage: function (page: any) { getPage: function (page: any) {
@@ -219,6 +234,22 @@ export default defineComponent({
}) })
}, },
get_totals() {
let path = import.meta.env.VITE_BASE_URL + '/deliverystatus/tomorrow-totals';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.totals = response.data.totals || []
this.grand_total = response.data.grand_total || 0
}).catch((error: any) => {
console.error('Error fetching totals:', error);
this.totals = []
this.grand_total = 0
})
},
deleteCall(delivery_id: any) { deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id; let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({ axios({

View File

@@ -19,6 +19,18 @@
<div class="divider"></div> <div class="divider"></div>
<!-- Total Gallons -->
<div v-if="grand_total > 0 || totals.length > 0" class="mb-4">
<div v-if="grand_total > 0" class="mb-2">
<span class="badge badge-accent">Total: {{ grand_total }}</span>
</div>
<div class="flex flex-wrap gap-2">
<span v-for="total in totals" :key="total.town" class="badge badge-primary">
{{ total.town }}: {{ total.gallons }}
</span>
</div>
</div>
<!-- DESKTOP VIEW: Table --> <!-- DESKTOP VIEW: Table -->
<div class="overflow-x-auto hidden xl:block"> <div class="overflow-x-auto hidden xl:block">
<table class="table w-full"> <table class="table w-full">
@@ -149,6 +161,8 @@ export default defineComponent({
token: null, token: null,
user: null, user: null,
deliveries: [] as any[], deliveries: [] as any[],
totals: [] as any[],
grand_total: 0,
page: 1, page: 1,
perPage: 50, perPage: 50,
recordsLength: 0, recordsLength: 0,
@@ -165,6 +179,7 @@ export default defineComponent({
}, },
mounted() { mounted() {
this.getPage(this.page) this.getPage(this.page)
this.get_totals()
}, },
methods: { methods: {
getPage: function (page: any) { getPage: function (page: any) {
@@ -200,6 +215,22 @@ export default defineComponent({
this.deliveries = response.data this.deliveries = response.data
}) })
}, },
get_totals() {
let path = import.meta.env.VITE_BASE_URL + '/deliverystatus/waiting-totals';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.totals = response.data.totals || []
this.grand_total = response.data.grand_total || 0
}).catch((error: any) => {
console.error('Error fetching totals:', error);
this.totals = []
this.grand_total = 0
})
},
deleteCall(delivery_id: any) { deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id; let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({ axios({