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

@@ -6,9 +6,11 @@ import router from './router';
import Notifications from '@kyvg/vue3-notification';
import Pagination from 'v-pagination-3';
import { createPinia } from 'pinia';
import { PDFPlugin } from 'vue3-pdfmake';
const app = createApp(App)
app.use(createPinia());
app.use(createPinia())
app.use(router)
app.use(PDFPlugin)
.component('pagination', Pagination);
app.use(Notifications).mount('#app')

View File

@@ -30,10 +30,10 @@
<div class="col-span-6 bg-secondary">
<div class="grid grid-cols-12 p-5 bg-neutral m-5">
<div class="col-span-12 font-bold text-xl">Todays Oil Price</div>
<div class="col-span-12 py-2"> Price / Gallon: {{ today_oil_price }}</div>
<div class="col-span-12 py-2"> Price / Gallon: ${{ today_oil_price }}</div>
<div class="col-span-12 py-2"> Same Day: ${{ price_same_day }}</div>
<div class="col-span-12 py-2"> Prime: ${{ price_prime }}</div>
<div class="col-span-12 py-2"> Price / Employee: ${{ price_for_employee }}</div>
</div>
</div>
<div class="col-span-6 bg-secondary">

View File

@@ -4,7 +4,7 @@
<div class="">
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class=" w-full px-10 pb-10">
<div class="text-sm breadcrumbs">
<ul>
<li>
@@ -19,8 +19,9 @@
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex justify-end mb-10">
Customers {{ customer_count }}
</div>
<div class="overflow-x-auto bg-neutral font-bold">
@@ -109,6 +110,7 @@ export default defineComponent({
token: null,
user: null,
customers: [],
customer_count: 0,
page: 1,
perPage: 50,
recordsLength: 0,
@@ -133,6 +135,7 @@ export default defineComponent({
// we simulate an api call that fetch the records from a backend
this.customers = [];
this.get_customers(page)
this.get_customer_count()
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
@@ -162,6 +165,16 @@ export default defineComponent({
this.customers = response.data
})
},
get_customer_count() {
let path = import.meta.env.VITE_BASE_URL + '/customer/count';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.customer_count = response.data.count
})
},
deleteCustomer(user_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/delete/' + user_id;
axios({

View File

@@ -23,8 +23,104 @@
<div class="grid grid-cols-12">
<div class="col-span-6 p-5">
<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 Oil Delivery
</div>
<form class="col-span-12 rounded-md px-8 pt-6 pb-8 mb-4 w-full" enctype="multipart/form-data"
@submit.prevent="onSubmit">
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Fill </label>
<input v-model="CreateOilOrderForm.basicInfo.customer_asked_for_fill" class="checkbox checkbox-xs"
id="fill" type="checkbox" />
</div>
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">Gallons Ordered</label>
<input v-model="CreateOilOrderForm.basicInfo.gallons_ordered"
:disabled="CreateOilOrderForm.basicInfo.customer_asked_for_fill == true"
class="input input-bordered input-sm w-full max-w-xs" id="title" type="text"
placeholder="# gallons" />
<span v-if="v$.CreateOilOrderForm.basicInfo.gallons_ordered.$error" class="text-red-600 text-center">
{{ v$.CreateOilOrderForm.basicInfo.gallons_ordered.$errors[0].$message }}
</span>
</div>
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">Expected </label>
<input v-model="CreateOilOrderForm.basicInfo.expected_delivery_date"
class="input input-bordered input-sm w-full max-w-xs" id="title" type="date" min="2023-01-01"
max="2030-01-01" />
<span v-if="v$.CreateOilOrderForm.basicInfo.expected_delivery_date.$error"
class="text-red-600 text-center">
{{ v$.CreateOilOrderForm.basicInfo.expected_delivery_date.$errors[0].$message }}
</span>
</div>
<div class="mb-4">
<label class="form-control">
<div class="label">
<span class="label-text">Delivery notes</span>
</div>
<textarea class="textarea textarea-bordered h-24"
placeholder="Describe any thing given from the customer .."
v-model="CreateOilOrderForm.basicInfo.dispatcher_notes_taken"></textarea>
</label>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Prime</label>
<input v-model="CreateOilOrderForm.basicInfo.prime" class="checkbox checkbox-xs" id="prime"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Same Day </label>
<input v-model="CreateOilOrderForm.basicInfo.same_day" class="checkbox checkbox-xs" id="same_day"
type="checkbox" />
</div>
<div class="flex-1 mb-4">
<label class="block text-white text-sm font-bold mb-2">Customer Cards Payment</label>
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
id="userCards" v-model="CreateOilOrderForm.basicInfo.userCards">
<option class="text-white" v-for="(card, index) in userCards" :key="index" :value="card['id']">
{{ card['type_of_card'] }} {{ card['card_number'] }}
</option>
</select>
</div>
<div class="flex-1 mb-4">
<label class="block text-white text-sm font-bold mb-2">Delivery Driver </label>
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
id="customer_state" v-model="CreateOilOrderForm.basicInfo.driver_driver">
<option class="text-white" v-for="(driver, index) in truckDriversList" :key="index"
:value="driver['id']">
{{ driver['employee_first_name'] }} {{ driver['employee_last_name'] }}
</option>
</select>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10 text-error">
One or Both must be selected
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Cash</label>
<input v-model="CreateOilOrderForm.basicInfo.cash" class="checkbox checkbox-xs" id="cash"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Credit </label>
<input v-model="CreateOilOrderForm.basicInfo.credit" class="checkbox checkbox-xs" id="Credit"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-sm btn-accent">
Create Oil Order
</button>
</div>
</form>
</div>
</div>
<div class="col-span-12 xl:col-span-6 p-5">
<div class="grid grid-cols-12">
<div class="col-span-12 font-bold flex pb-5 text-lg">{{ customer.account_number }}</div>
<div class="col-span-12 font-bold flex">
@@ -49,7 +145,6 @@
{{ customer.customer_zip }}
</div>
</div>
<div class="col-span-12 font-bold flex" v-if="customer.customer_apt !== 'None'">
{{ customer.customer_apt }}
</div>
@@ -65,18 +160,13 @@
<div class="col-span-12 font-bold flex">
{{ customer.customer_phone_number }}
</div>
<table class="table col-span-12">
<!-- head -->
<thead>
<tr>
<th>id</th>
<th>Date</th>
<th>Gallons</th>
<th>Status</th>
<th>Prime</th>
<th>Same Day</th>
@@ -119,115 +209,7 @@
</table>
</div>
</div>
<div class="col-span-6 rounded-md p-6 ">
<div class="grid grid-cols-12">
<div class="col-span-12 text-[24px]">
Create Oil Delivery
</div>
<form class="col-span-12 rounded-md px-8 pt-6 pb-8 mb-4 w-full" enctype="multipart/form-data"
@submit.prevent="onSubmit">
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Fill </label>
<input v-model="CreateOilOrderForm.basicInfo.customer_asked_for_fill" class="checkbox checkbox-xs"
id="fill" type="checkbox" />
</div>
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">Gallons Ordered</label>
<input v-model="CreateOilOrderForm.basicInfo.gallons_ordered"
:disabled="CreateOilOrderForm.basicInfo.customer_asked_for_fill == true"
class="input input-bordered input-sm w-full max-w-xs" id="title" type="text"
placeholder="# gallons" />
<span v-if="v$.CreateOilOrderForm.basicInfo.gallons_ordered.$error" class="text-red-600 text-center">
{{ v$.CreateOilOrderForm.basicInfo.gallons_ordered.$errors[0].$message }}
</span>
</div>
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">Expected </label>
<input v-model="CreateOilOrderForm.basicInfo.expected_delivery_date"
class="input input-bordered input-sm w-full max-w-xs" id="title" type="date" min="2023-01-01"
max="2030-01-01" />
<span v-if="v$.CreateOilOrderForm.basicInfo.expected_delivery_date.$error"
class="text-red-600 text-center">
{{ v$.CreateOilOrderForm.basicInfo.expected_delivery_date.$errors[0].$message }}
</span>
</div>
<div class="mb-4">
<label class="form-control">
<div class="label">
<span class="label-text">Delivery notes</span>
</div>
<textarea class="textarea textarea-bordered h-24"
placeholder="Describe any thing given from the customer .."
v-model="CreateOilOrderForm.basicInfo.dispatcher_notes_taken"></textarea>
</label>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Prime</label>
<input v-model="CreateOilOrderForm.basicInfo.prime" class="checkbox checkbox-xs" id="prime"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Same Day </label>
<input v-model="CreateOilOrderForm.basicInfo.same_day" class="checkbox checkbox-xs" id="same_day"
type="checkbox" />
</div>
<div class="flex-1 mb-4">
<label class="block text-white text-sm font-bold mb-2">Customer Cards Payment</label>
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
id="userCards" v-model="CreateOilOrderForm.basicInfo.userCards">
<option class="text-white" v-for="(card, index) in userCards" :key="index" :value="card['id']">
{{ card['type_of_card'] }} {{ card['card_number'] }}
</option>
</select>
</div>
<div class="flex-1 mb-4">
<label class="block text-white text-sm font-bold mb-2">Delivery Driver </label>
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
id="customer_state" v-model="CreateOilOrderForm.basicInfo.driver_driver">
<option class="text-white" v-for="(driver, index) in truckDriversList" :key="index"
:value="driver['id']">
{{ driver['employee_first_name'] }} {{ driver['employee_last_name'] }}
</option>
</select>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10 text-error">
One or Both must be selected
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Cash</label>
<input v-model="CreateOilOrderForm.basicInfo.cash" class="checkbox checkbox-xs" id="cash"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Credit </label>
<input v-model="CreateOilOrderForm.basicInfo.credit" class="checkbox checkbox-xs" id="Credit"
type="checkbox" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-sm btn-accent">
Create Oil Order
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@@ -303,7 +285,6 @@ export default defineComponent({
basicInfo: {
gallons_ordered: { required, minLength: minLength(1) },
expected_delivery_date: { required },
},
},
};
@@ -455,7 +436,6 @@ export default defineComponent({
});
pass += 1;
}
if (this.CreateOilOrderForm.basicInfo.cash === false && this.CreateOilOrderForm.basicInfo.credit === false) {
notify({
title: "Error",
@@ -464,13 +444,10 @@ export default defineComponent({
});
pass += 1;
}
if (pass == 0) {
this.CreateOilOrder(payload);
}
},
},
})
</script>

View File

@@ -90,6 +90,7 @@
<div v-else-if="deliveryOrder.delivery_status == 4">Partial Delivery</div>
<div v-else-if="deliveryOrder.delivery_status == 5">misdelivery</div>
<div v-else-if="deliveryOrder.delivery_status == 6">unknown</div>
<div v-else-if="deliveryOrder.delivery_status == 10">Finalized</div>
<div v-else></div>
</div>
@@ -111,7 +112,7 @@
<div class="col-span-12 font-bold mt-5">
When Delivered
</div>
<div class="col-span-12 text-gray-500 " >
<div class="col-span-12 text-gray-500 ">
{{ deliveryOrder.when_delivered }}
</div>
@@ -121,8 +122,6 @@
<div class="col-span-12 text-gray-500">
{{ deliveryOrder.driver_first_name }} {{ deliveryOrder.driver_last_name }}
</div>
</div>
</div>
</div>
@@ -130,15 +129,9 @@
<div class="col-span-6 ">
<div class="grid grid-cols-12 ">
<div class="col-span-12 py-3">
<div class="col-span-12">
<div v-if="deliveryOrder.prime == 1">
<div class="col-span-12 ">
Prime
@@ -177,7 +170,7 @@
</div>
</div>
<div class="col-span-12 mt-5">
<div class="col-span-12 ">
<div class="col-span-12 font-bold">
Payment
</div>
@@ -188,17 +181,12 @@
<div v-else-if="deliveryOrder.payment_type == 2">Credit Card & cash</div>
<div v-else>No Payment Type Added</div>
</div>
</div>
</div>
<div class="col-span-12 mt-5">
<div class="col-span-12 font-bold">
<div class="grid grid-cols-12 mb-5">
<div class="col-span-12 ">
Price / Gallon
</div>
@@ -206,7 +194,6 @@
{{ deliveryOrder.customer_price }}
</div>
<div class="col-span-12 " v-if="deliveryOrder.customer_asked_for_fill == 1">
<div class="">
Gallons Ordered:
@@ -216,7 +203,6 @@
</div>
</div>
<div class="col-span-12 py-3">
<div class="">
Gallons delivered:
@@ -226,7 +212,6 @@
</div>
</div>
<div class="col-span-12 py-3">
<div class="">
Gallons Ordered:
@@ -236,7 +221,6 @@
</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.prime == 1">
<div class="">
Prime Fee:
@@ -246,17 +230,15 @@
</div>
</div>
<div class="col-span-12 " v-if="deliveryOrder.same_day === 1">
<div>
Same Day
Same Day
</div>
<div class="col-span-12 text-gray-500">
{{ pricing.price_same_day }}
</div>
</div>
<div class="col-span-12 " v-if="deliveryOrder.payment_type == 0">
<div class="col-span-12 ">
cash total:
@@ -266,11 +248,9 @@
</div>
</div>
<div class="col-span-12 py-5 " v-if="deliveryOrder.payment_type == 1">
<div class="flex">
<div class="flex">
<div class="rounded-md border-2 bg-accent">
<div class="flex p-2">
{{ userCard.type_of_card }}
@@ -285,13 +265,12 @@
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12 py-5 " v-if="deliveryOrder.payment_type == 2">
<div class="flex ">
<div class="col-span-12 py-5 " v-if="deliveryOrder.payment_type == 2">
<div class="flex ">
<div class=" rounded-md border-2 bg-accent ">
<div class="flex p-1 pl-4">
@@ -303,13 +282,13 @@
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12 font-bold py-5 text-lg text-accent" v-if="deliveryOrder.payment_type == 1">
<div >
<div>
Pre Charge Credit Card Total
</div>
<div class="col-span-12 text-green-500">
@@ -317,31 +296,31 @@
</div>
</div>
<div class="col-span-12 font-bold py-5 text-lg text-accent" v-if="deliveryOrder.payment_type == 2">
<div >
<div>
Pre Charge Credit Card Total
</div>
<div class="col-span-12 text-green-500">
${{ total_amount }}
</div>
</div>
</div>
</div>
</div>
<form class="rounded-md " enctype="multipart/form-data" @submit.prevent="onSubmit">
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-sm btn-accent">
Finalize Delivery
</button>
<div v-if="deliveryOrder.delivery_status !== 10">
<form class="rounded-md " enctype="multipart/form-data" @submit.prevent="onSubmit">
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-sm btn-accent">
Finalize Delivery
</button>
</div>
</div>
</div>
</form>
</form>
</div>
<div v-else>Order was finalized</div>
</div>
</div>
@@ -481,7 +460,7 @@ export default defineComponent({
$route() {
this.sumdelivery(this.$route.params.id);
this.getOilOrder(this.$route.params.id);
},
},
@@ -520,11 +499,11 @@ export default defineComponent({
if (response.data) {
this.deliveryOrder = response.data
this.getCustomer(this.deliveryOrder.customer_id)
if (this.deliveryOrder.payment_type === 1 ) {
if (this.deliveryOrder.payment_type === 1) {
this.getPaymentCard(this.deliveryOrder.payment_card_id);
}
if (this.deliveryOrder.payment_type === 2 ) {
if (this.deliveryOrder.payment_type === 2) {
this.getPaymentCard(this.deliveryOrder.payment_card_id);
}
if (response.data.prime == 1) {

View File

@@ -202,7 +202,7 @@
</div>
</div>
<div class="col-span-6 mt-5">
<div class="col-span-6 ">
<div class="col-span-12 font-bold">
Info
</div>
@@ -225,7 +225,7 @@
</div>
</div>
</div>
<div class="col-span-6 mt-5">
<div class="col-span-6 ">
<div class="col-span-12 font-bold">
Notes
</div>

View File

@@ -82,6 +82,11 @@
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent">Edit</button>
</router-link>
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">
Print
</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
</td>
</tr>

View File

@@ -82,6 +82,12 @@
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent ">Edit</button>
</router-link>
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">
Print
</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
</td>
</tr>

View File

@@ -17,9 +17,9 @@
<div class="flex start pb-10 text-2xl">Todays Deliveries </div>
<div class="flex justify-end pb-5">
<button @click.prevent="printtTicketAll" class="btn btn-accent btn-sm">
<!-- <button @click.prevent="printtTicketAll" class="btn btn-accent btn-sm">
Print All
</button>
</button> -->
</div>
<div class="overflow-x-auto bg-neutral">
@@ -88,10 +88,11 @@
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">Edit</button>
</router-link>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent btn-sm">
Print
</button>
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">
Print
</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-error btn-sm">
Delete
</button>
@@ -227,52 +228,52 @@ export default defineComponent({
})
},
printtTicketAll() {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/print_today';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Sent to Printer",
type: "success",
});
this.getPage(this.page)
} else {
notify({
title: "Failure",
text: "error printing",
type: "success",
});
}
})
},
printTicket(delivery_id: number) {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/' + delivery_id;
axios({
method: 'options',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Sent to Printer",
type: "success",
});
this.getPage(this.page)
} else {
notify({
title: "Failure",
text: "error printing",
type: "success",
});
}
})
},
// printtTicketAll() {
// let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/print_today';
// axios({
// method: 'get',
// url: path,
// headers: authHeader(),
// }).then((response: any) => {
// if (response.data.ok) {
// notify({
// title: "Success",
// text: "Sent to Printer",
// type: "success",
// });
// this.getPage(this.page)
// } else {
// notify({
// title: "Failure",
// text: "error printing",
// type: "success",
// });
// }
// })
// },
// printTicket(delivery_id: number) {
// let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/' + delivery_id;
// axios({
// method: 'options',
// url: path,
// headers: authHeader(),
// }).then((response: any) => {
// if (response.data.ok) {
// notify({
// title: "Success",
// text: "Sent to Printer",
// type: "success",
// });
// this.getPage(this.page)
// } else {
// notify({
// title: "Failure",
// text: "error printing",
// type: "success",
// });
// }
// })
// },
},
})
</script>

View File

@@ -88,10 +88,11 @@
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">Edit</button>
</router-link>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent btn-sm">
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">
Print
</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-error btn-sm">
Delete
</button>

View File

@@ -86,9 +86,15 @@
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">Edit</button>
</router-link>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent btn-sm">Print</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-error btn-sm">Delete</button>
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">
Print
</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-error btn-sm">
Delete
</button>
</td>
</tr>
</tbody>

View File

@@ -325,7 +325,6 @@ export default defineComponent({
priceprime: 0,
pricesameday: 0,
total_amount: 0,
total_precharge_amount: 0
}
},
validations() {
@@ -368,9 +367,7 @@ export default defineComponent({
this.priceprime = response.data.priceprime;
this.pricesameday = response.data.pricesameday;
this.total_amount = response.data.total_amount;
}
})
.catch(() => {
notify({
@@ -379,10 +376,8 @@ export default defineComponent({
type: "error",
});
});
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({

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>