tons fixes

This commit is contained in:
2025-08-25 17:58:30 -04:00
parent 4bcff598e6
commit adc1606312
15 changed files with 800 additions and 237 deletions

View File

@@ -20,9 +20,10 @@
</ul>
</div>
<div class="grid grid-cols-12 ">
<div class="col-span-12 bg-neutral ">
<!-- TOP SECTION: Customer Info and Pricing Chart -->
<div class="grid grid-cols-12 gap-5 mb-5">
<!-- Customer Info -->
<div class="col-span-12 lg:col-span-6 bg-neutral rounded-lg p-5">
<div class="col-span-12 py-5 ">
<router-link :to="{ name: 'customerProfile', params: { id: customer['id'] } }"
class="btn btn-secondary btn-sm">
@@ -36,19 +37,16 @@
{{ customer.customer_last_name }}
</div>
<div class="col-span-12 font-bold flex">
{{ customer.customer_address }}
<div v-if="customer.customer_apt != 'None'">
{{ customer.customer_apt }}
</div>
</div>
<div class="col-span-12 font-bold flex">
<div class="pr-2">
{{ customer.customer_town }},
</div>
<div class="pr-2">
<div v-if="customer.customer_state == 0">Massachusetts</div>
<div v-else-if="customer.customer_state == 1">Rhode Island</div>
<div v-else-if="customer.customer_state == 2">New Hampshire</div>
@@ -62,7 +60,6 @@
{{ customer.customer_zip }}
</div>
</div>
<div class="col-span-12 font-bold flex" v-if="customer.customer_apt !== 'None'">
{{ customer.customer_apt }}
</div>
@@ -81,7 +78,34 @@
</div>
</div>
<div class="col-span-6 rounded-md p-6 ">
<!-- Pricing Chart -->
<div class="col-span-12 lg:col-span-6 bg-neutral rounded-lg p-5">
<h3 class="text-xl font-bold mb-4">Price Per Gallon</h3>
<div class="overflow-x-auto">
<table class="table w-full">
<thead>
<tr>
<th>Gallons</th>
<th>Total Price</th>
</tr>
</thead>
<tbody>
<!-- THE FIX IS ON THE NEXT LINE -->
<tr v-for="(price, gallons) in pricingTiers" :key="gallons" class="hover">
<th>{{ gallons }}</th>
<td>${{ parseFloat(price).toFixed(2) }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- BOTTOM SECTION: Forms -->
<div class="grid grid-cols-12 gap-5">
<!-- Create Delivery Form -->
<div class="col-span-12 xl:col-span-6 rounded-md p-6 ">
<div class="grid grid-cols-12">
<div class="col-span-12 text-[24px] ">
Create Delivery
@@ -147,10 +171,6 @@
<div v-else>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 py-5">
No Cards on File!
<!-- <router-link :to="{ name: 'cardadd', params: { id: customer.id } }">
<button class="btn btn-sm bg-blue-700 text-white">Add Credit Card</button>
</router-link> -->
</div>
</div>
@@ -207,8 +227,6 @@
class="textarea block p-2.5 w-full input-bordered " id="description" type="text" placeholder="Notes on ticket" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn-sm btn bg-orange-600 text-white">
Create Delivery
@@ -218,12 +236,10 @@
</div>
</div>
<!-- Add Credit Card Form -->
<div class="col-span-12 xl:col-span-6 p-5">
<div class="grid grid-cols-12 ">
<div class="col-span-12 text-2xl">Add a Credit Card</div>
<div class="col-span-12">
<form class="rounded-md px-8 pt-6 pb-8 mb-4 w-full" enctype="multipart/form-data"
@submit.prevent="onSubmitCard">
@@ -321,9 +337,6 @@
class="input input-bordered input-sm w-full max-w-xs" id="title" type="text"
placeholder="Zip Code" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn-sm btn bg-orange-600 text-white">
Save Credit Card
@@ -333,21 +346,17 @@
</div>
</div>
</div>
</div>
<div class="grid grid-cols-12 ">
<div class="col-span-12 text-center font-bold text-3xl">Remind customer of tank Inspection</div>
<div class="col-span-12 text-center font-bold text-3xl">Ask how they heard about us</div>
</div>
</div>
</div>
<Footer />
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import axios from 'axios'
@@ -376,6 +385,7 @@ export default defineComponent({
userCards: [],
promos: [],
truckDriversList: [],
pricingTiers: {}, // NEW: To store pricing data
CreateOilOrderForm: {
basicInfo: {
gallons_ordered: '',
@@ -452,6 +462,7 @@ export default defineComponent({
this.userStatus()
this.getDriversList()
this.getPromos()
this.getPricingTiers() // NEW: Call the method to get prices
},
watch: {
$route() {
@@ -462,11 +473,31 @@ export default defineComponent({
},
mounted() {
this.getCustomer(this.$route.params.id)
this.getPaymentCards(this.$route.params.id);
this.getCustomerDelivery(this.$route.params.id)
},
methods: {
// NEW: Method to fetch pricing data
getPricingTiers() {
let path = import.meta.env.VITE_BASE_URL + "/info/price/oil/tiers";
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.pricingTiers = response.data;
})
.catch(() => {
notify({
title: "Pricing Error",
text: "Could not retrieve today's pricing.",
type: "error",
});
});
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
@@ -494,7 +525,6 @@ export default defineComponent({
})
.then((response: any) => {
this.customer = response.data;
})
.catch(() => {
notify({
@@ -525,7 +555,6 @@ export default defineComponent({
})
.then((response: any) => {
this.userCards = response.data;
})
.catch(() => {
});