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

@@ -1,28 +1,26 @@
<template>
<footer class="footer p-10 bg-neutral text-neutral-content mt-20">
<nav>
<h6 class="footer-title">Services</h6>
<a class="link link-hover">Branding</a>
<a class="link link-hover">Design</a>
<a class="link link-hover">Marketing</a>
<a class="link link-hover">Advertisement</a>
</nav>
<nav>
<h6 class="footer-title">Company</h6>
<a class="link link-hover">About us</a>
<a class="link link-hover">Contact</a>
<a class="link link-hover">Jobs</a>
<a class="link link-hover">Press kit</a>
</nav>
<nav>
<h6 class="footer-title">Legal</h6>
<a class="link link-hover">Terms of use</a>
<a class="link link-hover">Privacy policy</a>
<a class="link link-hover">Cookie policy</a>
</nav>
</footer>
<footer class="footer p-10 bg-neutral text-neutral-content mt-20 bg-secondary">
<nav>
<h6 class="footer-title">Services</h6>
<a class="link link-hover">Branding</a>
<a class="link link-hover">Design</a>
<a class="link link-hover">Marketing</a>
<a class="link link-hover">Advertisement</a>
</nav>
<nav>
<h6 class="footer-title">Company</h6>
<a class="link link-hover">About us</a>
<a class="link link-hover">Contact</a>
<a class="link link-hover">Jobs</a>
<a class="link link-hover">Press kit</a>
</nav>
<nav>
<h6 class="footer-title">Legal</h6>
<a class="link link-hover">Terms of use</a>
<a class="link link-hover">Privacy policy</a>
<a class="link link-hover">Cookie policy</a>
</nav>
</footer>
</template>
@@ -37,10 +35,8 @@ export default defineComponent({
}
},
mounted() {},
mounted() { },
methods: {},
})
</script>
<style>
</style>
<style></style>

View File

@@ -55,6 +55,14 @@ export default defineComponent({
user_id: 0,
user_name: '',
},
company: {
company_dba_name: '',
company_llc_name: '',
company_town: '',
company_stat: 0,
company_zip: '0',
},
employee: {
id: '',
user_id: '',
@@ -180,7 +188,21 @@ export default defineComponent({
})
},
getCompany() {
let path = import.meta.env.VITE_BASE_URL + '/admin/company/' + import.meta.env.COMPANY_ID;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.company = response.data;
})
},
},
});
</script>

View File

@@ -29,6 +29,9 @@
</li>
<div class="font-bold text-lg text-gray-500 pt-5">Delivery</div>
<li>
<router-link :to="{ name: 'delivery' }">
<div class=" hover:underline py-1">Home</div>
</router-link>
<router-link :to="{ name: 'deliveryOutForDelivery' }">
<div class=" hover:underline py-1">Todays Deliveries</div>
</router-link>

View File

@@ -1,8 +1,8 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
@@ -17,34 +17,42 @@
<div class="flex text-2xl mb-5">
Welcome {{ employee.employee_first_name }} {{ employee.employee_last_name }}!
</div>
<div class="grid grid-cols-12 gap-5">
<div class="col-span-12 bg-neutral ">
<div class="grid grid-cols-12 gap-5 ">
<div class="col-span-12 bg-secondary ">
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 font-bold text-xl">Todays stats</div>
<div class="col-span-6 py-2"> Total Deliveries: {{delivery_count}}</div>
<div class="col-span-6 py-2"> Total Deliveries: {{ delivery_count }}</div>
<div class="col-span-6 py-2"> Completed: {{ delivery_count_delivered }} / {{ delivery_count }}</div>
</div>
</div>
<div class="col-span-6 bg-neutral" >
<div class="grid grid-cols-12 p-5 ">
<div class="col-span-6 bg-neutral">
<div class="grid grid-cols-12 p-5 bg-secondary">
<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"> Same Day: ${{same_day}}</div>
<div class="col-span-12 py-2"> Prime: ${{prime}}</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-neutral" >
<div class="col-span-6 bg-neutral">
<div class="grid grid-cols-12 p-5 bg-secondary">
<div class="col-span-12 font-bold text-xl">Quick Tips</div>
<div class="col-span-12 py-2"> search: @ = last name search</div>
<div class="col-span-12 py-2"> search: ! = address</div>
<div class="col-span-12 py-2"> search: # = phone number</div>
</div>
</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'
@@ -64,10 +72,12 @@ export default defineComponent({
return {
token: null,
delivery_count: 0,
today_oil_price: '',
same_day: '',
prime: '',
out_of_oil: '',
delivery_count_delivered: 0,
price_from_supplier: 0,
today_oil_price: 0,
price_for_employee: 0,
price_same_day: 0,
price_prime: 0,
user: {
user_id: 0,
user_name: '',
@@ -108,16 +118,16 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
this.employeeStatus()
} else {
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
this.employeeStatus()
} else {
localStorage.removeItem('user');
this.$router.push('/login');
}
})
localStorage.removeItem('user');
this.$router.push('/login');
}
})
},
@@ -129,11 +139,11 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.employee = response.data;
this.loaded = true;
.then((response: any) => {
this.employee = response.data;
this.loaded = true;
})
})
},
today_delivery_count() {
@@ -144,11 +154,22 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.delivery_count = response.data.data;
})
.then((response: any) => {
this.delivery_count = response.data.data;
})
},
today_delivery_delivered() {
let path = import.meta.env.VITE_BASE_URL + '/stats/delivery/count/delivered/today'
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.delivery_count_delivered = response.data.data;
})
},
today_price_oil() {
let path = import.meta.env.VITE_BASE_URL + '/info/price/oil'
axios({
@@ -157,17 +178,20 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
this.today_oil_price = response.data.price;
})
.then((response: any) => {
this.price_from_supplier = response.data.price_from_supplier;
this.today_oil_price = response.data.price_for_customer;
this.price_for_employee = response.data.price_for_employee;
this.price_same_day = response.data.price_same_day;
this.price_prime = response.data.price_prime;
})
},
},
})
</script>
<style scoped>
</style>
<style scoped></style>
<script setup lang="ts">
</script>

View File

@@ -29,6 +29,7 @@
<!-- head -->
<thead>
<tr>
<th>Ticket ID</th>
<th>Due Date</th>
<th>Status</th>
<th>Town</th>
@@ -41,6 +42,7 @@
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }}</td>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
@@ -61,16 +63,13 @@
<td>
{{ oil['expected_delivery_date'] }}
</td>
<td>
<div v-if="oil['automatic'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
</td>
</tr>

View File

@@ -1,8 +1,8 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
@@ -27,52 +27,55 @@
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Name</th>
<th>Town</th>
<th>Automatic</th>
<th>Phone Number</th>
<th></th>
</tr>
<tr>
<th>Account Number</th>
<th>Name</th>
<th>Town</th>
<th>Automatic</th>
<th>Phone Number</th>
<th></th>
</tr>
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="person in customers" :key="person['id']">
<!-- row 1 -->
<tr v-for="person in customers" :key="person['id']">
<td>{{ person['account_number'] }}</td>
<td>
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }">
{{ person['customer_first_name'] }} {{ person['customer_last_name'] }}
</router-link>
</td>
<td>{{ person['customer_town'] }}</td>
<td>
<div v-if="person['customer_automatic'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>{{ person['customer_phone_number'] }}</td>
<td>
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }">
{{ person['customer_first_name'] }} {{ person['customer_last_name'] }}
</router-link>
</td>
<td>{{ person['customer_town'] }}</td>
<td>
<div v-if="person['customer_automatic'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>{{ person['customer_phone_number'] }}</td>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryCreate', params: { id: person['id'] } }"
class="cursor-pointer underline hover:text-blue-300">
Oil
</router-link>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryCreate', params: { id: person['id'] } }" class="cursor-pointer underline hover:text-blue-300">
Oil
</router-link>
<router-link :to="{ name: 'customerEdit', params: { id: person['id'] } }" class="cursor-pointer underline hover:text-blue-300">
Edit
</router-link>
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }" class="cursor-pointer underline hover:text-blue-300">
View
</router-link>
<a @click.prevent="deleteCustomer(person['id'])" class="cursor-pointer underline hover:text-blue-300">
Delete
</a>
</td>
</tr>
<router-link :to="{ name: 'customerEdit', params: { id: person['id'] } }"
class="cursor-pointer underline hover:text-blue-300">
Edit
</router-link>
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }"
class="cursor-pointer underline hover:text-blue-300">
View
</router-link>
<a @click.prevent="deleteCustomer(person['id'])" class="cursor-pointer underline hover:text-blue-300">
Delete
</a>
</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>
@@ -80,11 +83,11 @@
</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'
@@ -140,15 +143,15 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.catch(() => {
this.user = null
})
}
})
.catch(() => {
this.user = null
})
},
get_customers(page: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/all/' + page;
@@ -160,7 +163,7 @@ export default defineComponent({
this.customers = response.data
})
},
deleteCustomer(user_id: any) {
deleteCustomer(user_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/delete/' + user_id;
axios({
method: 'delete',
@@ -168,13 +171,11 @@ export default defineComponent({
headers: authHeader(),
}).then(() => {
this.get_customers(1)
this.get_customers(1)
})
},
},
})
</script>
<style scoped>
</style>
<style scoped></style>

View File

@@ -210,6 +210,7 @@
<!-- head -->
<thead>
<tr>
<th>id</th>
<th>Status</th>
<th>Town</th>
<th>Name</th>
@@ -224,6 +225,7 @@
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }}</td>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>

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 class="flex start pb-10">Finalized Delivery </div>
<div class="flex justify-start pb-5">
</div>
</div>
<div class="overflow-x-auto">
<div class="overflow-x-auto">
<div class="flex start">Finalized Deliveries</div>
<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 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>
<div class="overflow-x-auto">
<div class="flex start">Tommorrows Deliveries </div>
<table class="table">
<!-- head -->
<thead>
<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>
<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,7 +55,7 @@
<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>
@@ -75,130 +81,180 @@
<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>
</div>
<Footer/>
</template>
<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";
<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',
export default defineComponent({
name: 'deliveryOutForDelivery',
components: {
Header,
SideBar,
Footer,
},
components: {
Header,
SideBar,
Footer,
},
data() {
return {
token: null,
user: null,
deliveries: [],
page: 1,
perPage: 50,
recordsLength: 0,
options: {
edgeNavigation: false,
format: false,
template: PaginationComp
}
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
})
},
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
})
},
})
</script>
<style scoped>
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",
});
}
})
},
</style>
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>

View File

@@ -21,7 +21,7 @@
</div>
<div class="flex justify-end">
<router-link :to="{ name: 'employeeCreate' }">
<button class="btn">Create Employee</button>
<button class="btn btn-accent">Create Employee</button>
</router-link>
</div>
@@ -30,6 +30,7 @@
<!-- head -->
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Town</th>
@@ -42,7 +43,6 @@
<tr v-for="person in employees" :key="person['id']">
<td>{{ person['employee_first_name'] }} {{ person['employee_last_name'] }}</td>
<td>
<div v-if="person['employee_type'] == 0">Owner</div>
<div v-else-if="person['employee_type'] == 1">Manager</div>
@@ -54,7 +54,6 @@
<div v-else-if="person['employee_type'] == 7">Cash</div>
<div v-else-if="person['employee_type'] == 8">Driver/Tech</div>
<div v-else></div>
</td>
<td>{{ person['employee_town'] }}</td>
@@ -62,10 +61,10 @@
<td>{{ person['employee_phone_number'] }}</td>
<td class="flex gap-5">
<router-link :to="{ name: 'employeeEdit', params: { id: person['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
<router-link :to="{ name: 'employeeProfile', params: { id: person['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
</td>
</tr>

View File

@@ -1,8 +1,8 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10">
<div class="text-sm breadcrumbs">
@@ -18,15 +18,15 @@
</div>
<div class="grid grid-cols-1 rounded-md p-6 mb-5">
<div class="grid grid-cols-1 rounded-md p-6 mb-5" v-if="loaded">
<div class=" col-span-12 text-[24px]">
Confirm Payment Oil Delivery {{ delivery.id }}
</div>
<div class="grid grid-cols-12 bg-neutral mb-5">
<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">
{{ customer.customer_first_name }}
{{ customer.customer_last_name }}
@@ -75,12 +75,12 @@
<div class="col-span-12 ">
<div class="grid grid-cols-12 mb-5 bg-neutral">
<div class="col-span-12 py-3">
<div v-if="delivery.delivery_status == 0"> Delivery Status: Waiting</div>
<div v-else-if="delivery.delivery_status == 1">Delivery Status: delivered</div>
<div v-else-if="delivery.delivery_status == 2">Delivery Status: Out for Delivery</div>
<div v-else-if="delivery.delivery_status == 3">Delivery Status: Cancelled</div>
<div v-else-if="delivery.delivery_status == 4">Delivery Status: Partial Delivery</div>
<div v-else-if="delivery.delivery_status == 5">Delivery Status: Issue</div>
<div v-if="delivery.delivery_status == 0"> Delivery Status: Waiting</div>
<div v-else-if="delivery.delivery_status == 1">Delivery Status: delivered</div>
<div v-else-if="delivery.delivery_status == 2">Delivery Status: Out for Delivery</div>
<div v-else-if="delivery.delivery_status == 3">Delivery Status: Cancelled</div>
<div v-else-if="delivery.delivery_status == 4">Delivery Status: Partial Delivery</div>
<div v-else-if="delivery.delivery_status == 5">Delivery Status: Issue</div>
<div v-else></div>
</div>
@@ -141,43 +141,66 @@
<div v-else> Gallons Ordered: {{ delivery.gallons_ordered }}</div>
</div>
<div class="col-span-12 py-3" v-if="delivery.prime == 1">
Prime Fee: {{ delivery.prime }}
Prime Fee: {{ pricing.price_prime }}
</div>
<div class="col-span-12 py-3" v-if="delivery.same_day == 1">
Same Day: {{ delivery.same_day }}
Same Day: {{ pricing.price_same_day }}
</div>
<div class="col-span-12 font-bold py-5 text-lg" v-if="delivery.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="delivery.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="delivery.payment_type == 2">
<div class="">
Pre Charge Credit Card Total: ${{ total_amount }}
</div>
</div>
<div class="col-span-12 font-bold py-5 text-lg">Total: {{ delivery.total_price }}</div>
</div>
</div>
<div class="flex justify-between">
<!-- <button class="btn" @click="checkoutOilCreditStripe()">-->
<!-- Pay Credit Card (Stripe)-->
<!-- </button>-->
<button class="btn" @click="checkoutOilUpdatePayment(0)">
Cash Payment
</button>
<button class="btn" @click="checkoutOilUpdatePayment(1)">
Pay Credit Terminal
</button>
<!-- <button class="btn" @click="checkoutOilCreditStripe()">-->
<!-- Pay Credit Card (Stripe)-->
<!-- </button>-->
<div class="" v-if="delivery.payment_type == 0">
<button class="btn btn-primary" @click="checkoutOilUpdatePayment(0)">
Cash Payment
</button>
</div>
<div class="" v-if="delivery.payment_type == 1">
<button class="btn btn-accent" @click="checkoutOilUpdatePayment(1)">
Pay Credit Terminal
</button>
</div>
<div class="" v-if="delivery.payment_type == 2">
Cash +
<button class="btn btn-accent" @click="checkoutOilUpdatePayment(3)">
Pay Credit Terminal
</button>
</div>
</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 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";
import { notify } from "@kyvg/vue3-notification"
import { minLength, required } from "@vuelidate/validators";
export default defineComponent({
name: 'PayOil',
@@ -191,6 +214,7 @@ export default defineComponent({
data() {
return {
v$: useValidate(),
loaded: false,
user: {
user_id: 0,
},
@@ -241,6 +265,7 @@ export default defineComponent({
}
],
stripe: null,
customer: {
id: 0,
@@ -256,14 +281,25 @@ export default defineComponent({
customer_phone_number: '',
account_number: '',
},
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
}
},
validations() {
return {
CreateOilOrderForm: {
basicInfo: {
gallons_ordered: {required, minLength: minLength(1)},
expected_delivery_date: {required},
gallons_ordered: { required, minLength: minLength(1) },
expected_delivery_date: { required },
},
},
};
@@ -279,10 +315,28 @@ export default defineComponent({
},
mounted() {
this.getOilOrder(this.$route.params.id)
this.getOilPricing()
// this.getStripePublishableKey();
},
methods: {
sumdelivery() {
if (this.delivery.same_day == 1)
this.pricesameday = this.pricing.price_same_day
else { this.pricesameday = 0 };
if (this.delivery.prime == 1)
this.priceprime = this.pricing.price_prime
else { this.priceprime = 0 };
this.total_amount = Number(this.delivery.total_price) + Number(this.priceprime) + Number(this.pricesameday)
this.loaded = true
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
@@ -291,13 +345,34 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
},
getOilPricing() {
let path = import.meta.env.VITE_BASE_URL + "/info/price/oil/table";
axios({
method: "get",
url: path,
withCredentials: true,
})
.then((response: any) => {
this.pricing = response.data;
this.sumdelivery();
})
.catch(() => {
notify({
title: "Error",
text: "Could not get oil pricing",
type: "error",
});
});
},
getOilOrder(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/" + delivery_id;
axios({
@@ -305,19 +380,19 @@ export default defineComponent({
url: path,
withCredentials: true,
})
.then((response: any) => {
this.delivery = response.data;
this.getCustomer(this.delivery.customer_id)
this.getCreditCards(this.delivery.customer_id)
.then((response: any) => {
this.delivery = response.data;
this.getCustomer(this.delivery.customer_id)
this.getCreditCards(this.delivery.customer_id)
})
.catch(() => {
notify({
title: "Error",
text: "Could not get oil order",
type: "error",
});
})
.catch(() => {
notify({
title: "Error",
text: "Could not get oil order",
type: "error",
});
});
},
getCreditCards(user_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/payment/cards/' + user_id;
@@ -347,22 +422,22 @@ export default defineComponent({
method: "PUT",
url: path,
})
.then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "marked payment as STRIPE credit card",
type: "error",
});
}
})
.catch(() => {
.then((response: any) => {
if (response.data.ok) {
notify({
title: "Error",
text: "Could not update with credit card",
title: "Success",
text: "marked payment as STRIPE credit card",
type: "error",
});
}
})
.catch(() => {
notify({
title: "Error",
text: "Could not update with credit card",
type: "error",
});
});
},
checkoutOilUpdatePayment(payment_type: number) {
@@ -371,32 +446,32 @@ export default defineComponent({
method: "PUT",
url: path,
})
.then((response: any) => {
if (response.data.ok) {
if (payment_type == 1) {
notify({
title: "Success",
text: "marked payment as credit (bank terminal)",
type: "success",
});
}
if (payment_type == 0) {
notify({
title: "Success",
text: "marked payment as cash (COD)",
type: "success",
});
}
this.$router.push({name: "customerProfile", params: {id: this.customer.id}});
.then((response: any) => {
if (response.data.ok) {
if (payment_type == 1) {
notify({
title: "Success",
text: "marked payment as credit (bank terminal)",
type: "success",
});
}
})
.catch(() => {
notify({
title: "Error",
text: "Could not update wth cash",
type: "error",
});
if (payment_type == 0) {
notify({
title: "Success",
text: "marked payment as cash (COD)",
type: "success",
});
}
this.$router.push({ name: "customerProfile", params: { id: this.customer.id } });
}
})
.catch(() => {
notify({
title: "Error",
text: "Could not update wth cash",
type: "error",
});
});
},
// checkoutOilCreditStripe() {
@@ -420,24 +495,24 @@ export default defineComponent({
// });
// },
// getStripePublishableKey() {
// let path = import.meta.env.VITE_PAY_URL + "/pay/config";
// axios({
// method: "get",
// url: path,
// })
// .then((response: any) => {
// this.stripe = Stripe(response.data.publicKey);
// })
// .catch(() => {
// notify({
// title: "Error",
// text: "Could not find customer",
// type: "error",
// });
// });
// },
//
// getStripePublishableKey() {
// let path = import.meta.env.VITE_PAY_URL + "/pay/config";
// axios({
// method: "get",
// url: path,
// })
// .then((response: any) => {
// this.stripe = Stripe(response.data.publicKey);
// })
// .catch(() => {
// notify({
// title: "Error",
// text: "Could not find customer",
// type: "error",
// });
// });
// },
//
},
})

View File

@@ -7,8 +7,8 @@ module.exports = {
themes: [{
mytheme: {
"primary": "#0256bf",
"secondary": "#1e1d24",
"accent": "#7F00FF",
"secondary": "#262732",
"accent": "#161fac",
"neutral": "#1e1d24",
"base-100": "#1e1d24",
"info": "#74a0d5",