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

763
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,12 +14,15 @@
"@vuelidate/validators": "^2.0.4", "@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^10.7.0", "@vueuse/core": "^10.7.0",
"axios": "^1.6.2", "axios": "^1.6.2",
"html-to-image": "^1.11.11",
"html2canvas": "^1.4.1",
"moment": "^2.30.1", "moment": "^2.30.1",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"v-pagination-3": "^0.1.7", "v-pagination-3": "^0.1.7",
"vue": "^3.3.11", "vue": "^3.3.11",
"vue-debounce": "^5.0.0", "vue-debounce": "^5.0.0",
"vue-router": "^4.2.5", "vue-router": "^4.2.5",
"vue3-pdfmake": "^2.2.0",
"vuelidate": "^0.7.7" "vuelidate": "^0.7.7"
}, },
"devDependencies": { "devDependencies": {

View File

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

View File

@@ -30,10 +30,10 @@
<div class="col-span-6 bg-secondary"> <div class="col-span-6 bg-secondary">
<div class="grid grid-cols-12 p-5 bg-neutral m-5"> <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 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"> Same Day: ${{ price_same_day }}</div>
<div class="col-span-12 py-2"> Prime: ${{ price_prime }}</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> </div>
<div class="col-span-6 bg-secondary"> <div class="col-span-6 bg-secondary">

View File

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

View File

@@ -23,8 +23,104 @@
<div class="grid grid-cols-12"> <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="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 pb-5 text-lg">{{ customer.account_number }}</div>
<div class="col-span-12 font-bold flex"> <div class="col-span-12 font-bold flex">
@@ -49,7 +145,6 @@
{{ customer.customer_zip }} {{ customer.customer_zip }}
</div> </div>
</div> </div>
<div class="col-span-12 font-bold flex" v-if="customer.customer_apt !== 'None'"> <div class="col-span-12 font-bold flex" v-if="customer.customer_apt !== 'None'">
{{ customer.customer_apt }} {{ customer.customer_apt }}
</div> </div>
@@ -65,18 +160,13 @@
<div class="col-span-12 font-bold flex"> <div class="col-span-12 font-bold flex">
{{ customer.customer_phone_number }} {{ customer.customer_phone_number }}
</div> </div>
<table class="table col-span-12"> <table class="table col-span-12">
<!-- head --> <!-- head -->
<thead> <thead>
<tr> <tr>
<th>id</th> <th>id</th>
<th>Date</th> <th>Date</th>
<th>Gallons</th> <th>Gallons</th>
<th>Status</th> <th>Status</th>
<th>Prime</th> <th>Prime</th>
<th>Same Day</th> <th>Same Day</th>
@@ -119,115 +209,7 @@
</table> </table>
</div> </div>
</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> </div>
</div> </div>
@@ -303,7 +285,6 @@ export default defineComponent({
basicInfo: { basicInfo: {
gallons_ordered: { required, minLength: minLength(1) }, gallons_ordered: { required, minLength: minLength(1) },
expected_delivery_date: { required }, expected_delivery_date: { required },
}, },
}, },
}; };
@@ -455,7 +436,6 @@ export default defineComponent({
}); });
pass += 1; pass += 1;
} }
if (this.CreateOilOrderForm.basicInfo.cash === false && this.CreateOilOrderForm.basicInfo.credit === false) { if (this.CreateOilOrderForm.basicInfo.cash === false && this.CreateOilOrderForm.basicInfo.credit === false) {
notify({ notify({
title: "Error", title: "Error",
@@ -464,13 +444,10 @@ export default defineComponent({
}); });
pass += 1; pass += 1;
} }
if (pass == 0) { if (pass == 0) {
this.CreateOilOrder(payload); this.CreateOilOrder(payload);
} }
}, },
}, },
}) })
</script> </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 == 4">Partial Delivery</div>
<div v-else-if="deliveryOrder.delivery_status == 5">misdelivery</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 == 6">unknown</div>
<div v-else-if="deliveryOrder.delivery_status == 10">Finalized</div>
<div v-else></div> <div v-else></div>
</div> </div>
@@ -111,7 +112,7 @@
<div class="col-span-12 font-bold mt-5"> <div class="col-span-12 font-bold mt-5">
When Delivered When Delivered
</div> </div>
<div class="col-span-12 text-gray-500 " > <div class="col-span-12 text-gray-500 ">
{{ deliveryOrder.when_delivered }} {{ deliveryOrder.when_delivered }}
</div> </div>
@@ -121,8 +122,6 @@
<div class="col-span-12 text-gray-500"> <div class="col-span-12 text-gray-500">
{{ deliveryOrder.driver_first_name }} {{ deliveryOrder.driver_last_name }} {{ deliveryOrder.driver_first_name }} {{ deliveryOrder.driver_last_name }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -130,15 +129,9 @@
<div class="col-span-6 "> <div class="col-span-6 ">
<div class="grid grid-cols-12 "> <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 v-if="deliveryOrder.prime == 1">
<div class="col-span-12 "> <div class="col-span-12 ">
Prime Prime
@@ -177,7 +170,7 @@
</div> </div>
</div> </div>
<div class="col-span-12 mt-5"> <div class="col-span-12 ">
<div class="col-span-12 font-bold"> <div class="col-span-12 font-bold">
Payment Payment
</div> </div>
@@ -188,17 +181,12 @@
<div v-else-if="deliveryOrder.payment_type == 2">Credit Card & cash</div> <div v-else-if="deliveryOrder.payment_type == 2">Credit Card & cash</div>
<div v-else>No Payment Type Added</div> <div v-else>No Payment Type Added</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-span-12 mt-5"> <div class="col-span-12 mt-5">
<div class="col-span-12 font-bold"> <div class="col-span-12 font-bold">
<div class="grid grid-cols-12 mb-5"> <div class="grid grid-cols-12 mb-5">
<div class="col-span-12 "> <div class="col-span-12 ">
Price / Gallon Price / Gallon
</div> </div>
@@ -206,7 +194,6 @@
{{ deliveryOrder.customer_price }} {{ deliveryOrder.customer_price }}
</div> </div>
<div class="col-span-12 " v-if="deliveryOrder.customer_asked_for_fill == 1"> <div class="col-span-12 " v-if="deliveryOrder.customer_asked_for_fill == 1">
<div class=""> <div class="">
Gallons Ordered: Gallons Ordered:
@@ -216,7 +203,6 @@
</div> </div>
</div> </div>
<div class="col-span-12 py-3"> <div class="col-span-12 py-3">
<div class=""> <div class="">
Gallons delivered: Gallons delivered:
@@ -226,7 +212,6 @@
</div> </div>
</div> </div>
<div class="col-span-12 py-3"> <div class="col-span-12 py-3">
<div class=""> <div class="">
Gallons Ordered: Gallons Ordered:
@@ -236,7 +221,6 @@
</div> </div>
</div> </div>
<div class="col-span-12" v-if="deliveryOrder.prime == 1"> <div class="col-span-12" v-if="deliveryOrder.prime == 1">
<div class=""> <div class="">
Prime Fee: Prime Fee:
@@ -246,17 +230,15 @@
</div> </div>
</div> </div>
<div class="col-span-12 " v-if="deliveryOrder.same_day === 1"> <div class="col-span-12 " v-if="deliveryOrder.same_day === 1">
<div> <div>
Same Day Same Day
</div> </div>
<div class="col-span-12 text-gray-500"> <div class="col-span-12 text-gray-500">
{{ pricing.price_same_day }} {{ pricing.price_same_day }}
</div> </div>
</div> </div>
<div class="col-span-12 " v-if="deliveryOrder.payment_type == 0"> <div class="col-span-12 " v-if="deliveryOrder.payment_type == 0">
<div class="col-span-12 "> <div class="col-span-12 ">
cash total: cash total:
@@ -266,11 +248,9 @@
</div> </div>
</div> </div>
<div class="col-span-12 py-5 " v-if="deliveryOrder.payment_type == 1"> <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="rounded-md border-2 bg-accent">
<div class="flex p-2"> <div class="flex p-2">
{{ userCard.type_of_card }} {{ userCard.type_of_card }}
@@ -285,13 +265,12 @@
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }} {{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div> </div>
</div> </div>
</div>
</div> </div>
</div>
<div class="col-span-12 py-5 " v-if="deliveryOrder.payment_type == 2"> <div class="col-span-12 py-5 " v-if="deliveryOrder.payment_type == 2">
<div class="flex "> <div class="flex ">
<div class=" rounded-md border-2 bg-accent "> <div class=" rounded-md border-2 bg-accent ">
<div class="flex p-1 pl-4"> <div class="flex p-1 pl-4">
@@ -303,13 +282,13 @@
<div class="flex p-1 pl-4"> <div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }} {{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div> </div>
</div>
</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 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 Pre Charge Credit Card Total
</div> </div>
<div class="col-span-12 text-green-500"> <div class="col-span-12 text-green-500">
@@ -317,31 +296,31 @@
</div> </div>
</div> </div>
<div class="col-span-12 font-bold py-5 text-lg text-accent" v-if="deliveryOrder.payment_type == 2"> <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 Pre Charge Credit Card Total
</div> </div>
<div class="col-span-12 text-green-500"> <div class="col-span-12 text-green-500">
${{ total_amount }} ${{ total_amount }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="deliveryOrder.delivery_status !== 10">
<form class="rounded-md " enctype="multipart/form-data" @submit.prevent="onSubmit"> <form class="rounded-md " enctype="multipart/form-data" @submit.prevent="onSubmit">
<div class="grid grid-cols-12 p-5"> <div class="grid grid-cols-12 p-5">
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5"> <div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-sm btn-accent"> <button class="btn btn-sm btn-accent">
Finalize Delivery Finalize Delivery
</button> </button>
</div>
</div> </div>
</div> </form>
</form> </div>
<div v-else>Order was finalized</div>
</div> </div>
</div> </div>
@@ -481,7 +460,7 @@ export default defineComponent({
$route() { $route() {
this.sumdelivery(this.$route.params.id); this.sumdelivery(this.$route.params.id);
this.getOilOrder(this.$route.params.id); this.getOilOrder(this.$route.params.id);
}, },
}, },
@@ -520,11 +499,11 @@ export default defineComponent({
if (response.data) { if (response.data) {
this.deliveryOrder = response.data this.deliveryOrder = response.data
this.getCustomer(this.deliveryOrder.customer_id) 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); 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); this.getPaymentCard(this.deliveryOrder.payment_card_id);
} }
if (response.data.prime == 1) { if (response.data.prime == 1) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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