added print button and finalize

This commit is contained in:
2024-03-29 19:57:34 -04:00
parent 5b13032cd6
commit 2d9fce2e89
21 changed files with 1040 additions and 684 deletions

View File

@@ -325,6 +325,21 @@ export default defineComponent({
.catch(() => {
});
},
getDriversList() {
let path = import.meta.env.VITE_BASE_URL + "/employee/drivers";
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.truckDriversList = response.data;
})
.catch(() => {
});
},
CreateOilOrder(payload: {
gallons_ordered: string;
customer_asked_for_fill: boolean;
@@ -369,25 +384,16 @@ export default defineComponent({
credit_card_id: this.CreateOilOrderForm.basicInfo.userCards,
driver_employee_id: this.CreateOilOrderForm.basicInfo.driver_driver,
};
if (this.CreateOilOrderForm.basicInfo.driver_driver == ''){
notify({
title: "Error",
text: "Did not add a driver",
type: "error",
});
}
this.CreateOilOrder(payload);
},
getDriversList() {
let path = import.meta.env.VITE_BASE_URL + "/employee/drivers";
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.truckDriversList = response.data;
})
.catch(() => {
});
},
},
})
</script>

View File

@@ -25,6 +25,7 @@
<!-- head -->
<thead>
<tr>
<th>Ticket id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
@@ -39,6 +40,8 @@
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['id'] }}</td>
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>

View File

@@ -1,9 +1,9 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs mb-10">
@@ -21,7 +21,8 @@
</ul>
</div>
<div class="grid grid-cols-1 rounded-md pb-5">
<div class="grid grid-cols-1 rounded-md pb-5" v-if="total_amount">
<div class="text-[24px]">
Finalize Oil Order # {{ deliveryOrder.id }}
</div>
@@ -75,7 +76,7 @@
</div>
<div class="col-span-6 ">
<div class="flex justify-end" v-if="deliveryOrder.id ">
<div class="flex justify-end" v-if="deliveryOrder.id">
<router-link :to="{ name: 'deliveryEdit', params: { id: deliveryOrder.id } }">
<button class="btn">Edit Order</button>
</router-link>
@@ -96,12 +97,12 @@
</div>
<div class="col-span-12">
<div v-if="deliveryOrder.delivery_status == 0">waiting</div>
<div v-else-if="deliveryOrder.delivery_status == 1">delivered</div>
<div v-else-if="deliveryOrder.delivery_status == 1">delivered</div>
<div v-else-if="deliveryOrder.delivery_status == 2">Out for Delivery</div>
<div v-else-if="deliveryOrder.delivery_status == 3">Cancelled</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 == 6">unknown</div>
<div v-else-if="deliveryOrder.delivery_status == 3">Cancelled</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 == 6">unknown</div>
<div v-else></div>
</div>
<div class="col-span-12 font-bold mt-5">
@@ -132,22 +133,22 @@
</div>
<div class="grid grid-cols-12 bg-neutral p-5">
<div class="col-span-12 font-bold">
<div v-if="deliveryOrder.customer_asked_for_fill==1">Fill</div>
<div v-if="deliveryOrder.customer_asked_for_fill == 1">Fill</div>
<div v-else>Gallons delivered: {{ deliveryOrder.gallons_delivered }}</div>
</div>
<div class="col-span-12 font-bold">
<div v-if="deliveryOrder.prime==1">
<div v-if="deliveryOrder.prime == 1">
Prime Required: Yes
</div>
<div v-if="deliveryOrder.prime==0">
<div v-if="deliveryOrder.prime == 0">
Prime Required: No
</div>
</div>
<div class="col-span-12 font-bold">
<div v-if="deliveryOrder.same_day==1">
<div v-if="deliveryOrder.same_day == 1">
Same Day: Yes
</div>
<div v-if="deliveryOrder.same_day==0">
<div v-if="deliveryOrder.same_day == 0">
Same Day: No
</div>
</div>
@@ -160,12 +161,12 @@
</div>
<div class="grid grid-cols-12 bg-neutral p-2">
<div class="col-span-12 font-bold">
<div v-if="deliveryOrder.payment_type==0">Cash</div>
<div v-else-if="deliveryOrder.payment_type==1">Credit Card</div>
<div v-else-if="deliveryOrder.payment_type==2">Credit Card & cash</div>
<div v-if="deliveryOrder.payment_type == 0">Cash</div>
<div v-else-if="deliveryOrder.payment_type == 1">Credit Card</div>
<div v-else-if="deliveryOrder.payment_type == 2">Credit Card & cash</div>
<div v-else>No Payment Type Added</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type==1">
<div class="col-span-12" v-if="deliveryOrder.payment_type == 1">
<div class="flex">
<div class="basis-1/3 p-2">
<div class="bg-neutral rounded-md border-2 ">
@@ -176,7 +177,7 @@
{{ userCard.name_on_card }}
</div>
<div class="flex p-1 pl-4">
****-****-****-{{ userCard.last_four_digits }}
{{ userCard.card_number }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
@@ -186,18 +187,18 @@
</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type==2">
<div class="col-span-12" v-if="deliveryOrder.payment_type == 2">
<div class="flex">
<div class="basis-1/3 p-2">
<div class="bg-neutral rounded-md border-2 ">
<div class="flex p-3">
{{ userCard.type_of_card }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.name_on_card }}
</div>
<div class="flex p-1 pl-4">
****-****-****-{{ userCard.last_four_digits }}
{{ userCard.card_number }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
@@ -206,68 +207,69 @@
</div>
</div>
</div>
<div class="col-span-12 ">Total {{deliveryMoney.total_amount}}</div>
</div>
</div>
<div class="col-span-6 mt-5">
<div class="col-span-12 font-bold">
Change Details
</div>
<form class="rounded-md bg-neutral " enctype="multipart/form-data" @submit.prevent="onSubmit">
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 mb-5 md:mb-0 gap-10 ">
<label class="block text-white text-sm font-bold mb-2">Gallons Ordered</label>
<input v-model="CreateOilOrderForm.basicInfo.gallons_delivered"
class="input input-bordered w-full max-w-xs"
id="title" type="text" placeholder="# gallons"/>
<div class="grid grid-cols-12 mb-5 bg-neutral">
<div class="col-span-12 py-3">Price / Gallon: {{ deliveryOrder.customer_price }}</div>
<div class="col-span-12 py-3">
<div v-if="deliveryOrder.customer_asked_for_fill == 1"> Gallons Ordered: FILL (250)</div>
<div v-else> Gallons Ordered: {{ deliveryOrder.gallons_ordered }}</div>
</div>
<div class="col-span-12mb-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"
id="prime"
type="checkbox"/>
<div class="col-span-12 py-3" v-if="deliveryOrder.prime == 1">
Prime Fee: {{ pricing.price_prime }}
</div>
<div class="col-span-12 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"
id="same_day"
type="checkbox"/>
<div class="col-span-12 py-3" v-if="deliveryOrder.same_day == 1">
Same Day: {{ pricing.price_same_day }}
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button
class="btn">
Finalize Delivery
</button>
<div class="col-span-12 font-bold py-5 text-lg" v-if="deliveryOrder.payment_type == 0">
<div class="">
CASH Total: ${{ total_amount }}
</div>
</div>
<div class="col-span-12 font-bold py-5 text-lg text-primary" v-if="deliveryOrder.payment_type == 1">
<div class="">
Pre Charge Credit Card Total: ${{ total_amount }}
</div>
</div>
<div class="col-span-12 font-bold py-5 text-lg text-primary" v-if="deliveryOrder.payment_type == 2">
<div class="">
Pre Charge Credit Card Total: ${{ total_amount }}
</div>
</div>
</div>
</form>
</div>
</div>
<form class="rounded-md bg-neutral" 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">
Finalize Delivery
</button>
</div>
</div>
</form>
</div>
</div>
<Footer/>
<Footer />
</template>
<script lang="ts">
import {defineComponent} from 'vue'
import { defineComponent } from 'vue'
import axios from 'axios'
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 { notify } from "@kyvg/vue3-notification"
export default defineComponent({
@@ -282,6 +284,7 @@ export default defineComponent({
data() {
return {
v$: useValidate(),
loaded: false,
user: {
id: 0
},
@@ -364,7 +367,19 @@ export default defineComponent({
driver_employee_id: 0,
driver_first_name: '',
driver_last_name: '',
total_price: 0,
},
pricing: {
price_from_supplier: 0,
price_for_customer: 0,
price_for_employee: 0,
price_same_day: 0,
price_prime: 0,
date: "",
},
priceprime: 0,
pricesameday: 0,
total_amount: 0
}
},
@@ -373,14 +388,16 @@ export default defineComponent({
},
watch: {
$route() {
this.sumdelivery(this.$route.params.id);
this.getOilOrder(this.$route.params.id);
this.getOilOrderMoney(this.$route.params.id);
this.get_delivery_amount(this.$route.params.id);
this.getOilPricing();
},
},
mounted() {
this.sumdelivery(this.$route.params.id);
this.getOilOrder(this.$route.params.id);
this.getOilOrderMoney(this.$route.params.id);
},
methods: {
@@ -392,14 +409,14 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
this.user.id = response.data.user_id;
}
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
this.user.id = response.data.user_id;
}
})
},
getOilOrder(delivery_id: any) {
getOilOrder(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/" + delivery_id;
axios({
method: "get",
@@ -407,41 +424,28 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
this.deliveryOrder = response.data
this.getCustomer(this.deliveryOrder.customer_id)
if (this.deliveryOrder.payment_type == 1) {
this.getPaymentCard(this.deliveryOrder.payment_card_id);
}
if (response.data.prime == 1) {
this.CreateOilOrderForm.basicInfo.prime = true
}
if (response.data.same_day == 1) {
this.CreateOilOrderForm.basicInfo.same_day = true
}
this.CreateOilOrderForm.basicInfo.gallons_delivered = response.data.gallons_delivered;
.then((response: any) => {
if (response.data) {
this.deliveryOrder = response.data
this.getCustomer(this.deliveryOrder.customer_id)
if (this.deliveryOrder.payment_type == 1) {
this.getPaymentCard(this.deliveryOrder.payment_card_id);
}
})
if (response.data.prime == 1) {
this.CreateOilOrderForm.basicInfo.prime = true
}
if (response.data.same_day == 1) {
this.CreateOilOrderForm.basicInfo.same_day = true
}
this.CreateOilOrderForm.basicInfo.gallons_delivered = response.data.gallons_delivered;
}
})
},
get_delivery_amount(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/amount/" + delivery_id;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
}
})
},
getCustomer(user_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/customer/" + user_id;
axios({
@@ -449,16 +453,16 @@ export default defineComponent({
url: path,
withCredentials: true,
})
.then((response: any) => {
this.customer = response.data;
})
.catch(() => {
notify({
title: "Error",
text: "Could not find customer",
type: "error",
});
.then((response: any) => {
this.customer = response.data;
})
.catch(() => {
notify({
title: "Error",
text: "Could not find customer",
type: "error",
});
});
},
getPaymentCard(card_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/payment/card/" + card_id;
@@ -467,27 +471,57 @@ export default defineComponent({
url: path,
withCredentials: true,
})
.then((response: any) => {
this.userCard = response.data;
})
.catch(() => {
});
.then((response: any) => {
this.userCard = response.data;
})
.catch(() => {
});
},
getOilOrderMoney(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/money/" + delivery_id;
getOilPricing() {
let path = import.meta.env.VITE_BASE_URL + "/info/price/oil/table";
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
this.deliveryMoney = response.data
}
})
.then((response: any) => {
this.pricing = response.data;
})
.catch(() => {
notify({
title: "Error",
text: "Could not get oil pricing",
type: "error",
});
});
},
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",
});
});
},
editOilOrder(payload: {
@@ -506,24 +540,24 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
notify({
.then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Ticket is finalized",
type: "success",
});
this.$router.push({name: "deliveryTicketsMissing"});
}
if (response.data.error) {
notify({
this.$router.push({ name: "deliveryTicketsMissing" });
}
if (response.data.error) {
notify({
title: "Error",
text: "Could not finalize ticket",
type: "error",
});
this.$router.push("deliveryTicketsMissing");
}
})
this.$router.push("deliveryTicketsMissing");
}
})
},
onSubmit() {

View File

@@ -80,7 +80,7 @@
<div class="col-span-6 ">
<div class="flex justify-end" v-if="deliveryOrder.id ">
<router-link :to="{ name: 'deliveryEdit', params: { id: deliveryOrder.id } }">
<button class="btn">Edit Order</button>
<button class="btn btn-accent">Edit Order</button>
</router-link>
</div>
</div>

View File

@@ -1,26 +1,27 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex start pb-10">Cancelled Deliveries </div>
<div class="flex justify-start pb-5">
</div>
<div class="overflow-x-auto">
<div class="flex start">Cancelled Deliveries</div>
<div class="flex start"> </div>
<table class="table">
<!-- head -->
<thead>
@@ -75,12 +76,12 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
</td>
</tr>
</tbody>

View File

@@ -1,26 +1,27 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex start pb-10">Delivered Deliveries </div>
<div class="flex justify-start pb-5">
</div>
<div class="overflow-x-auto">
<div class="flex start">Delivered Deliveries</div>
<table class="table">
<!-- head -->
<thead>
@@ -38,7 +39,8 @@
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<tr v-for="oil in deliveries" :key="oil['id']">
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
@@ -72,13 +74,9 @@
</td>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<router-link :to="{ name: 'finalizeTicket', params: { id: oil['id'] } }">
<button class="btn btn-accent">Finalize</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
</td>
</tr>
</tbody>
@@ -160,6 +158,7 @@ export default defineComponent({
this.user = null
})
},
get_oil_orders(page: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delivered/' + page;
axios({

View File

@@ -1,30 +1,32 @@
<template>
<Header/>
<div class="flex">
<div class="">
<SideBar/>
<Header />
<div class="flex">
<div class="">
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
</div>
<div class="overflow-x-auto">
<div class="flex start">Finalized Deliveries</div>
<div class="flex start pb-10">Finalized Delivery </div>
<div class="flex justify-start pb-5">
</div>
<div class="overflow-x-auto">
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Ticket Id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
@@ -38,9 +40,11 @@
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }} </td>
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
@@ -73,12 +77,12 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
</td>
</tr>
</tbody>

View File

@@ -1,34 +1,35 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex start pb-10">Issue with Delivery </div>
<div class="flex justify-start pb-5">
</div>
<div class="overflow-x-auto">
<div class="flex start">Issue with Delivery</div>
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Ticket Id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
<th>Address</th>
<th>Gallons</th>
<th>Date</th>
@@ -39,8 +40,10 @@
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }} </td>
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
@@ -75,12 +78,12 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
</td>
</tr>
</tbody>

View File

@@ -1,111 +1,126 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex start pb-10">Out for Delivery </div>
<div class="flex justify-start pb-5">
<button @click.prevent="printtTicketAll" class="btn btn-accent">
Print All
</button>
</div>
<div class="overflow-x-auto">
<div class="flex start">Out for Delivery </div>
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Town</th>
<th>Address</th>
<th>Gallons</th>
<th>Date</th>
<th>Automatic</th>
<th>Prime</th>
<th>Same Day</th>
</tr>
<tr>
<th>Delivery Id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
<th>Address</th>
<th>Gallons</th>
<th>Date</th>
<th>Automatic</th>
<th>Prime</th>
<th>Same Day</th>
</tr>
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
<div v-else-if="oil['delivery_status'] == 2">Out for Delivery</div>
<div v-else-if="oil['delivery_status'] == 3">Cancelled</div>
<div v-else-if="oil['delivery_status'] == 4">Partial Delivery</div>
<div v-else-if="oil['delivery_status'] == 5">Issue</div>
<div v-else-if="oil['delivery_status'] == 10">Finalized</div>
<div v-else></div>
</td>
<!-- row 1 -->
<td>{{ oil['customer_town'] }}</td>
<td>{{ oil['customer_address'] }}</td>
<td>
<div v-if="oil['customer_asked_for_fill'] == 1">Fill</div>
<div v-else> {{ oil['gallons_ordered'] }}</div>
</td>
<td>{{ oil['expected_delivery_date'] }}</td>
<td>
<div v-if="oil['automatic'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>
<div v-if="oil['prime'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>
<div v-if="oil['same_day'] == 0">No</div>
<div v-else>Yes</div>
</td>
<tr v-for="oil in deliveries" :key="oil['id']">
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<td>{{ oil['id'] }} </td>
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
</td>
</tr>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
<div v-else-if="oil['delivery_status'] == 2">Out for Delivery</div>
<div v-else-if="oil['delivery_status'] == 3">Cancelled</div>
<div v-else-if="oil['delivery_status'] == 4">Partial Delivery</div>
<div v-else-if="oil['delivery_status'] == 5">Issue</div>
<div v-else-if="oil['delivery_status'] == 10">Finalized</div>
<div v-else></div>
</td>
<td>{{ oil['customer_town'] }}</td>
<td>{{ oil['customer_address'] }}</td>
<td>
<div v-if="oil['customer_asked_for_fill'] == 1">Fill</div>
<div v-else> {{ oil['gallons_ordered'] }}</div>
</td>
<td>{{ oil['expected_delivery_date'] }}</td>
<td>
<div v-if="oil['automatic'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>
<div v-if="oil['prime'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>
<div v-if="oil['same_day'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">
Delete
</button>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent">
Print
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex justify-center" v-if="recordsLength > 9">
<pagination @paginate="getPage" :records="recordsLength" v-model="page" :per-page="perPage"
:options="options">
<pagination @paginate="getPage" :records="recordsLength" v-model="page" :per-page="perPage" :options="options">
</pagination>
<div class="flex justify-center mb-10"> {{ recordsLength }} items Found</div>
</div>
</div>
</div>
<Footer/>
<Footer />
</template>
<script lang="ts">
import {defineComponent} from 'vue'
import { defineComponent } from 'vue'
import axios from 'axios'
import authHeader from '../../../services/auth.header'
import Header from '../../../layouts/headers/headerauth.vue'
import PaginationComp from '../../../components/pagination.vue'
import SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import {notify} from "@kyvg/vue3-notification";
import { notify } from "@kyvg/vue3-notification";
export default defineComponent({
name: 'deliveryOutForDelivery',
@@ -131,16 +146,15 @@ export default defineComponent({
}
}
},
created() {
this.userStatus()
this.updatestatus();
},
mounted() {
this.getPage(this.page)
},
methods: {
getPage: function (page: any) {
// we simulate an api call that fetch the records from a backend
this.deliveries = [];
this.get_oil_orders(page)
},
@@ -152,15 +166,32 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.catch(() => {
this.user = null
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.catch(() => {
this.user = null
})
},
updatestatus() {
let path = import.meta.env.VITE_BASE_URL + '/delivery/updatestatus/outfordelivery';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.update)
notify({
title: "Success",
text: "Updated Oil Orders",
type: "success",
});
else { }
})
},
get_oil_orders(page: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/outfordelivery/' + page;
axios({
@@ -171,6 +202,7 @@ export default defineComponent({
this.deliveries = response.data
})
},
deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({
@@ -194,10 +226,55 @@ export default defineComponent({
}
})
},
printtTicketAll() {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/all/print_today';
axios({
method: 'delete',
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: 'delete',
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>
<style scoped>
</style>
<style scoped></style>

View File

@@ -1,30 +1,34 @@
<template>
<Header/>
<div class="flex">
<div class="">
<SideBar/>
<Header />
<div class="flex">
<div class="">
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
</div>
<div class="overflow-x-auto">
<div class="flex start">Tommorrows Deliveries </div>
<table class="table">
<!-- head -->
<thead>
<div class="flex start pb-10">Tommorrows Deliveries </div>
<div class="flex justify-start pb-5">
<button @click.prevent="printtTicketAll" class="btn btn-accent">
Print All
</button>
</div>
<div class="overflow-x-auto">
<div class="flex start"> </div>
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Ticket Id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
@@ -35,13 +39,15 @@
<th>Prime</th>
<th>Same Day</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']">
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }} </td>
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
@@ -49,10 +55,10 @@
<div v-else-if="oil['delivery_status'] == 3">Cancelled</div>
<div v-else-if="oil['delivery_status'] == 4">Partial Delivery</div>
<div v-else-if="oil['delivery_status'] == 5">Issue</div>
<div v-else-if="oil['delivery_status'] == 10">Finalized</div>
<div v-else-if="oil['delivery_status'] == 10">Finalized</div>
<div v-else></div>
</td>
<td>{{ oil['customer_town'] }}</td>
<td>{{ oil['customer_address'] }}</td>
<td>
@@ -72,133 +78,183 @@
<div v-if="oil['same_day'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">
Delete
</button>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent">
Print
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex justify-center" v-if="recordsLength > 9">
<pagination @paginate="getPage" :records="recordsLength" v-model="page" :per-page="perPage"
:options="options">
</pagination>
<div class="flex justify-center mb-10"> {{ recordsLength }} items Found</div>
</div>
</tbody>
</table>
</div>
<div class="flex justify-center" v-if="recordsLength > 9">
<pagination @paginate="getPage" :records="recordsLength" v-model="page" :per-page="perPage" :options="options">
</pagination>
<div class="flex justify-center mb-10"> {{ recordsLength }} items Found</div>
</div>
</div>
<Footer/>
</template>
<script lang="ts">
import {defineComponent} from 'vue'
import axios from 'axios'
import authHeader from '../../../services/auth.header'
import Header from '../../../layouts/headers/headerauth.vue'
import PaginationComp from '../../../components/pagination.vue'
import SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import {notify} from "@kyvg/vue3-notification";
export default defineComponent({
name: 'deliveryOutForDelivery',
components: {
Header,
SideBar,
Footer,
},
data() {
return {
token: null,
user: null,
deliveries: [],
page: 1,
perPage: 50,
recordsLength: 0,
options: {
edgeNavigation: false,
format: false,
template: PaginationComp
}
</div>
<Footer />
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import axios from 'axios'
import authHeader from '../../../services/auth.header'
import Header from '../../../layouts/headers/headerauth.vue'
import PaginationComp from '../../../components/pagination.vue'
import SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import { notify } from "@kyvg/vue3-notification";
export default defineComponent({
name: 'deliveryOutForDelivery',
components: {
Header,
SideBar,
Footer,
},
data() {
return {
token: null,
user: null,
deliveries: [],
page: 1,
perPage: 50,
recordsLength: 0,
options: {
edgeNavigation: false,
format: false,
template: PaginationComp
}
}
},
created() {
this.userStatus()
},
mounted() {
this.getPage(this.page)
},
methods: {
getPage: function (page: any) {
this.deliveries = [];
this.get_oil_orders(page)
},
created() {
this.userStatus()
},
mounted() {
this.getPage(this.page)
},
methods: {
getPage: function (page: any) {
// we simulate an api call that fetch the records from a backend
this.deliveries = [];
this.get_oil_orders(page)
},
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;
}
})
.catch(() => {
this.user = null
})
},
get_oil_orders(page: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/outfordelivery/' + page;
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.deliveries = response.data
})
},
deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
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) {
notify({
title: "Success",
text: "deleted oil order",
type: "success",
});
this.getPage(this.page)
} else {
notify({
title: "Failure",
text: "error deleting oil order",
type: "success",
});
this.user = response.data.user;
}
})
},
.catch(() => {
this.user = null
})
},
})
</script>
<style scoped>
</style>
get_oil_orders(page: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/outfordelivery/' + page;
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.deliveries = response.data
})
},
deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "deleted oil order",
type: "success",
});
this.getPage(this.page)
} else {
notify({
title: "Failure",
text: "error deleting oil order",
type: "success",
});
}
})
},
printtTicketAll() {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/all/print_tommorrow';
axios({
method: 'delete',
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: 'delete',
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

@@ -1,34 +1,36 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex start pb-10">Waiting Deliveries </div>
<div class="flex justify-start pb-5">
<button @click.prevent="printtTicketAll" class="btn btn-accent">
Print All
</button>
</div>
<div class="overflow-x-auto">
<div class="flex start">Waiting Deliveries</div>
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Ticket Id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
<th>Address</th>
<th>Gallons</th>
<th>Date</th>
@@ -39,8 +41,10 @@
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }} </td>
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
@@ -75,12 +79,13 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent">Print</button>
</td>
</tr>
</tbody>
@@ -195,6 +200,53 @@ export default defineComponent({
}
})
},
printtTicketAll() {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/all/print_waiting';
axios({
method: 'delete',
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: 'delete',
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>