added promo. fixed bugs

This commit is contained in:
2024-10-07 17:34:38 -04:00
parent 7832e40bf3
commit e8ffae3b01
16 changed files with 1359 additions and 394 deletions

View File

@@ -4,13 +4,13 @@
<h6 class="footer-title">Social</h6>
<a class="link link-hover" href="https://www.facebook.com/auburnoil">Facebook</a>
<a class="link link-hover" href="https://www.google.com/search?client=firefox-b-1-d&sca_esv=02c44965d6d4b280&sca_upv=1&cs=1&output=search&kgmid=/g/11wcbqrx5l&q=Auburn+Oil&shndl=30&shem=lsde&source=sh/x/loc/act/m1/1&kgs=52995d809762cd61">Google</a>
<a class="link link-hover" href="auburnoil.com">Website</a>
<a class="link link-hover" href="https://auburnoil.com">Website</a>
</nav>
<nav>
<h6 class="footer-title">Quick Call</h6>
<a class="link link-hover">Trask Tank Worcester - (508) 791-5064</a>
<a class="link link-hover">Eddys Truck - (508) 304-9552</a>
<a class="link link-hover">Spring Rebuilders - (508) 799-9342</a>
<div class="">Trask Tank Worcester - (508) 791-5064</div>
<div class="">Eddys Truck - (508) 304-9552</div>
<div class="">Spring Rebuilders - (508) 799-9342</div>
</nav>
<nav>
<h6 class="footer-title">Other</h6>

View File

@@ -66,6 +66,9 @@
<router-link :to="{ name: 'oilprice' }">
<div class=" hover:underline py-1">Oil Pricing</div>
</router-link>
<router-link :to="{ name: 'promo' }">
<div class=" hover:underline py-1">Promos</div>
</router-link>
</li>
</ul>
</div>

View File

@@ -0,0 +1,180 @@
<template>
<Header/>
<div class="flex">
<div class="">
<SideBar/>
</div>
<div class=" w-full px-10">
<div class="text-sm breadcrumbs">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
<li>
<router-link :to="{ name: 'customer' }">
Customers
</router-link>
</li>
</ul>
</div>
<div class="grid grid-cols-1 rounded-md p-6 ">
<div class="text-[24px]">
Create Promo
</div>
<form class="rounded-md px-8 pt-6 pb-8 mb-4 w-full"
enctype="multipart/form-data"
@submit.prevent="onSubmit">
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Promotion Name</label>
<input v-model="CreatePromoForm.name_of_promotion"
class="input input-bordered input-sm w-full max-w-xs"
id="title" type="text" placeholder="Name"/>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Text Appears on Ticket</label>
<input v-model="CreatePromoForm.text_on_ticket"
class="input input-bordered input-sm w-full max-w-xs"
id="title" type="text" placeholder="Text on Ticket max 20 characters"/>
</div>
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">How much off gallon (0.05 for example)</label>
<input v-model="CreatePromoForm.money_off_delivery"
class="input input-bordered input-sm w-full max-w-xs"
id="title" type="text" placeholder="0.01"/>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0">
<textarea v-model="CreatePromoForm.description" rows="4"
class="textarea block p-2.5 w-full input-bordered " id="description" type="text" placeholder="Description of Promo" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button
class="btn btn-accent btn-sm">
Create Promo
</button>
</div>
</form>
</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 SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import useValidate from "@vuelidate/core";
import {notify} from "@kyvg/vue3-notification";
export default defineComponent({
name: 'PromoCreate',
components: {
Header,
SideBar,
Footer,
},
data() {
return {
v$: useValidate(),
user: null,
PromoOrder:{
id: 0,
name_of_promotion: '',
description: '',
money_off_delivery: '',
text_on_ticket: '',
},
CreatePromoForm: {
name_of_promotion: '',
description: '',
money_off_delivery: '',
text_on_ticket: '',
},
}
},
created() {
this.userStatus()
},
mounted() {
},
methods: {
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
method: 'get',
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.catch(() => {
this.user = null
})
},
CreatePromo(payload: {
name_of_promotion: string;
money_off_delivery: string;
description: string;
text_on_ticket: string;
}) {
let path = import.meta.env.VITE_BASE_URL + "/promo/create" ;
axios({
method: "post",
url: path,
data: payload,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
notify({
title: "update",
text: "Promo has been created!",
type: "success",
});
this.$router.push({name: "promo"});
}
if (response.data.error) {
this.$router.push("promo");
}
})
},
onSubmit() {
let payload = {
name_of_promotion: this.CreatePromoForm.name_of_promotion,
money_off_delivery: this.CreatePromoForm.money_off_delivery,
description: this.CreatePromoForm.description,
text_on_ticket: this.CreatePromoForm.text_on_ticket,
};
this.CreatePromo(payload);
},
},
})
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,206 @@
<template>
<Header/>
<div class="flex">
<div class="">
<SideBar/>
</div>
<div class=" w-full px-10">
<div class="text-sm breadcrumbs">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
<li>
<router-link :to="{ name: 'customer' }">
Customers
</router-link>
</li>
</ul>
</div>
<div class="grid grid-cols-1 rounded-md p-6 ">
<div class="text-[24px]">
Edit Promo {{ PromoOrder.name_of_promotion }}
</div>
<form class="rounded-md px-8 pt-6 pb-8 mb-4 w-full"
enctype="multipart/form-data"
@submit.prevent="onSubmit">
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Promotion Name</label>
<input v-model="CreatePromoForm.name_of_promotion"
class="input input-bordered input-sm w-full max-w-xs"
id="title" type="text" placeholder="Name"/>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 gap-10">
<label class="block text-white text-sm font-bold cursor-pointer label">Text on Ticket</label>
<input v-model="CreatePromoForm.text_on_ticket"
class="input input-bordered input-sm w-full max-w-xs"
id="title" type="text" placeholder="Text appears on ticket "/>
</div>
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">How much off gallon (0.05 for example)</label>
<input v-model="CreatePromoForm.money_off_delivery"
class="input input-bordered input-sm w-full max-w-xs"
id="title" type="text" placeholder="0.01"/>
</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0">
<textarea v-model="CreatePromoForm.description" rows="4"
class="textarea block p-2.5 w-full input-bordered " id="description" type="text" placeholder="Description of Promo" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button
class="btn btn-accent btn-sm">
Edit Promo
</button>
</div>
</form>
</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 SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import useValidate from "@vuelidate/core";
import {notify} from "@kyvg/vue3-notification";
export default defineComponent({
name: 'PromoEdit',
components: {
Header,
SideBar,
Footer,
},
data() {
return {
v$: useValidate(),
user: null,
PromoOrder:{
id: 0,
name_of_promotion: '',
description:'',
money_off_delivery: '',
text_on_ticket: ''
},
CreatePromoForm: {
name_of_promotion: '',
description:'',
money_off_delivery: '',
text_on_ticket: ''
},
}
},
created() {
this.userStatus()
},
watch: {
$route() {
this.getCurrentPromo(this.$route.params.id);
},
},
mounted() {
this.getCurrentPromo(this.$route.params.id);
},
methods: {
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
method: 'get',
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.catch(() => {
this.user = null
})
},
getCurrentPromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/promo/" + promo_id;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
this.PromoOrder = response.data
this.CreatePromoForm.name_of_promotion = response.data.name_of_promotion;
this.CreatePromoForm.description = response.data.description;
this.CreatePromoForm.money_off_delivery = response.data.money_off_delivery;
this.CreatePromoForm.text_on_ticket = response.data.text_on_ticket;
}
})
},
EditPromo(payload: {
name_of_promotion: string;
description: string;
money_off_delivery: string;
text_on_ticket: string;
}) {
let path = import.meta.env.VITE_BASE_URL + "/promo/edit/" + this.PromoOrder.id;
axios({
method: "put",
url: path,
data: payload,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
notify({
title: "update",
text: "Promo has been edited!",
type: "success",
});
this.$router.push({name: "promo"});
}
if (response.data.error) {
this.$router.push("promo");
}
})
},
onSubmit() {
let payload = {
name_of_promotion: this.CreatePromoForm.name_of_promotion,
description: this.CreatePromoForm.description,
text_on_ticket: this.CreatePromoForm.text_on_ticket,
money_off_delivery: this.CreatePromoForm.money_off_delivery,
};
this.EditPromo(payload);
},
},
})
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,220 @@
<template>
<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="flex start pb-10 text-2xl">Promos </div>
<div class="flex justify-end pb-5">
<router-link :to="{ name: 'promocreate' }">
<button class="btn btn-accent btn-sm">Create Promo</button>
</router-link>
</div>
<div class="overflow-x-auto">
<table class="table">
<!-- head -->
<thead class=" bg-neutral">
<tr>
<th>Id</th>
<th>Name</th>
<th>Pennys off gallon</th>
<th>Description</th>
<th>text_on_ticket</th>
<th></th>
</tr>
</thead>
<tbody class="bg-neutral">
<!-- row 1 -->
<tr v-for="promo in promos" :key="promo['id']">
<td>{{ promo['id'] }} </td>
<router-link :to="{ name: 'promoedit', params: { id: promo['id'] } }">
<td>
<div class="hover:text-accent">{{ promo['name_of_promotion'] }} </div>
</td>
</router-link>
<td>
{{ promo['money_off_delivery'] }}
</td>
<td>
{{ promo['description'] }}
</td>
<td>
{{ promo['text_on_ticket'] }}
</td>
<td class="flex gap-2">
<router-link :to="{ name: 'promoedit', params: { id: promo['id'] } }">
<button class="btn btn-accent btn-sm">Edit Promo</button>
</router-link>
<button @click.prevent="deletepromo(promo['id'])" class="btn btn-error btn-sm">
Delete
</button>
</td>
</tr>
</tbody>
</table>
</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 SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import { notify } from "@kyvg/vue3-notification";
export default defineComponent({
name: 'Promo',
components: {
Header,
SideBar,
Footer,
},
data() {
return {
token: null,
user: null,
promos: [],
}
},
created() {
this.userStatus()
},
mounted() {
this.promos = [];
this.getpromos()
},
methods: {
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
method: 'get',
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
}
})
.catch(() => {
this.user = null
})
},
getpromos() {
let path = import.meta.env.VITE_BASE_URL + '/promo/all';
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.promos = response.data
})
},
deletepromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/promo/delete/' + promo_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "deleted promo ",
type: "success",
});
this.getpromos()
} else {
notify({
title: "Failure",
text: "error deleting promo",
type: "success",
});
}
})
},
turnonpromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/promo/on/' + promo_id;
axios({
method: 'patch',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Promo is now online for all deliveries ",
type: "success",
});
this.getpromos()
} else {
notify({
title: "Failure",
text: "error adding promo",
type: "success",
});
}
})
},
turnoffpromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/promo/off/' + promo_id;
axios({
method: 'patch',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Promo is now offline for all deliveries ",
type: "success",
});
this.getpromos()
} else {
notify({
title: "Failure",
text: "error adding promo",
type: "success",
});
}
})
},
},
})
</script>
<style scoped></style>

View File

@@ -2,6 +2,11 @@
import OilPrice from '../admin/oilprice.vue';
import Promo from '../admin/promo/promo.vue';
import PromoCreate from '../admin/promo/create.vue';
import PromoEdit from '../admin/promo/edit.vue';
const adminRoutes = [
{
path: '/oilprice',
@@ -10,7 +15,25 @@ const adminRoutes = [
},
{
path: '/promo/edit:id',
name: 'promoedit',
component: PromoEdit,
},
{
path: '/promo/create',
name: 'promocreate',
component: PromoCreate,
},
{
path: '/promo',
name: 'promo',
component: Promo,
},
]
export default adminRoutes
//sourceMappingURL=index.ts.map

View File

@@ -132,16 +132,14 @@
<div class="text-[18px] mt-5 mb-5"> Description</div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0">
<textarea v-model="CreateCustomerForm.basicInfo.customer_description" rows="4"
class="textarea block p-2.5 w-full input-bordered " id="description" type="text" placeholder="Description of Customer House" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-accent btn-sm">
Create Customer
Submit Create Customer
</button>
</div>
</form>

View File

@@ -155,7 +155,7 @@
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn-sm btn btn-accent">
Edit Customer
Submit Edit Customer
</button>
</div>
</form>

View File

@@ -24,6 +24,7 @@
Customers {{ customer_count }}
</div>
<div class="overflow-x-auto bg-neutral font-bold">
<table class="table">
<!-- head -->
@@ -56,15 +57,17 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryCreate', params: { id: person['id'] } }"
class="btn btn-accent btn-sm">
Oil
Create Oil Order
</router-link>
<router-link :to="{ name: 'customerEdit', params: { id: person['id'] } }" class="btn btn-accent btn-sm">
Edit
Edit Customer
</router-link>
<router-link :to="{ name: 'cardadd', params: { id: person['id'] } }">
<button class="btn btn-sm btn-accent">Add CreditCard</button>
</router-link>
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }"
class=" btn btn-accent btn-sm">
View
View Profile
</router-link>
</td>

View File

@@ -162,7 +162,7 @@
<div class="col-span-6 font-bold flex ">
<router-link :to="{ name: 'cardadd', params: { id: customer.user_id } }">
<button class="btn btn-sm btn-accent">Add Credit Card</button>
<button class="btn btn-sm btn-accent">Add CreditCard</button>
</router-link>
</div>
<div class="col-span-12 font-bold flex">

View File

@@ -123,6 +123,16 @@
<input v-model="CreateOilOrderForm.basicInfo.other" class="checkbox checkbox-xs" id="Other"
type="checkbox" />
</div>
<div class="flex-1 mb-4">
<label class="block text-white text-sm font-bold mb-2">Select a Promo</label>
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
id="userCards" v-model="CreateOilOrderForm.basicInfo.promos">
<option class="text-white" v-for="(promo, index) in promos" :key="index" :value="promo['id']">
{{ promo['name_of_promotion'] }} {{ promo['money_off_delivery'] }}
</option>
</select>
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-sm btn-accent">
@@ -257,6 +267,7 @@ export default defineComponent({
user: null,
checked: false,
userCards: [],
promos: [],
truckDriversList: [],
CreateOilOrderForm: {
basicInfo: {
@@ -267,12 +278,14 @@ export default defineComponent({
prime: false,
emergency: false,
userCards: [],
promos: [],
same_day: false,
credit: false,
cash: false,
check: false,
other: false,
credit_card_id: 0,
promo_id: 0,
driver_driver: '',
},
},
@@ -308,6 +321,7 @@ export default defineComponent({
created() {
this.userStatus()
this.getDriversList()
this.getPromos()
},
watch: {
$route() {
@@ -318,6 +332,7 @@ export default defineComponent({
},
mounted() {
this.getCustomer(this.$route.params.id)
this.getPaymentCards(this.$route.params.id);
this.getCustomerDelivery(this.$route.params.id)
},
@@ -383,7 +398,19 @@ export default defineComponent({
.catch(() => {
});
},
getPromos() {
let path = import.meta.env.VITE_BASE_URL + "/promo/all" ;
axios({
method: "get",
url: path,
withCredentials: true,
})
.then((response: any) => {
this.promos = response.data;
})
.catch(() => {
});
},
getDriversList() {
let path = import.meta.env.VITE_BASE_URL + "/employee/drivers";
axios({
@@ -411,6 +438,7 @@ export default defineComponent({
expected_delivery_date: string;
dispatcher_notes_taken: string;
credit_card_id: any;
promo_id: any;
driver_employee_id: string,
}) {
@@ -446,6 +474,7 @@ export default defineComponent({
check: this.CreateOilOrderForm.basicInfo.check,
other: this.CreateOilOrderForm.basicInfo.other,
credit_card_id: this.CreateOilOrderForm.basicInfo.userCards,
promo_id: this.CreateOilOrderForm.basicInfo.promos,
driver_employee_id: this.CreateOilOrderForm.basicInfo.driver_driver,
};
let pass = 0;

View File

@@ -215,6 +215,18 @@
</option>
</select>
</div>
<div class="flex-1 mb-4">
<label class="block text-white text-sm font-bold mb-2">Select a Promo</label>
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
id="promos" v-model="CreateOilOrderForm.basicInfo.promo_id">
<option class="text-white" v-for="(promo, index) in promos" :key="index" :value="promo['id']">
{{ promo['name_of_promotion'] }} {{ promo['money_off_delivery'] }}
</option>
</select>
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn btn-accent btn-sm">
Edit Oil Delivery
@@ -255,6 +267,7 @@ export default defineComponent({
deliveryStatus: [],
truckDriversList: [],
userCards: [],
promos: [],
userCard: {
date_added: '',
@@ -308,9 +321,14 @@ export default defineComponent({
emergency: 0,
payment_type: 0,
payment_card_id: 0,
driver_employee_id: 0,
driver_first_name: '',
driver_last_name: '',
promo_id: 0,
promo_money_discount: '',
},
CreateOilOrderForm: {
basicInfo: {
@@ -323,7 +341,9 @@ export default defineComponent({
emergency: false,
delivery_status: '',
userCards: [],
promos: [],
credit_card_id: 0,
promo_id: 0,
cash: false,
card: false,
other: false,
@@ -345,6 +365,7 @@ export default defineComponent({
};
},
created() {
this.getPromos()
this.userStatus()
this.getDriversList()
},
@@ -377,7 +398,19 @@ export default defineComponent({
this.user = null
})
},
getPromos() {
let path = import.meta.env.VITE_BASE_URL + "/promo/all" ;
axios({
method: "get",
url: path,
withCredentials: true,
})
.then((response: any) => {
this.promos = response.data;
})
.catch(() => {
});
},
getDeliveryOrder(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL +"/delivery/" + delivery_id;
axios({
@@ -398,7 +431,10 @@ export default defineComponent({
this.CreateOilOrderForm.basicInfo.delivery_status = response.data.delivery.delivery_status;
this.CreateOilOrderForm.basicInfo.driver_driver = response.data.delivery.driver_employee_id;
if (response.data.delivery.delivery_asked_for_fill == 1) {
this.CreateOilOrderForm.basicInfo.customer_asked_for_fill = true
}
console.log(response.data.delivery.delivery_asked_for_fill)
if (response.data.delivery.payment_type == 1) {
this.CreateOilOrderForm.basicInfo.userCards = response.data.delivery.payment_card_id;
}
@@ -438,6 +474,10 @@ export default defineComponent({
this.CreateOilOrderForm.basicInfo.check = false
this.CreateOilOrderForm.basicInfo.other = true
}
if (response.data.delivery.promo_id !== 0) {
this.CreateOilOrderForm.basicInfo.promo_id = response.data.delivery.promo_id;
}
}
})
@@ -522,6 +562,7 @@ export default defineComponent({
credit: boolean;
check: boolean;
credit_card_id: any;
promo_id: any;
driver_employee_id: string,
}) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/edit/" + this.deliveryOrder.id;
@@ -556,6 +597,7 @@ export default defineComponent({
cash: this.CreateOilOrderForm.basicInfo.cash,
credit: this.CreateOilOrderForm.basicInfo.card,
check: this.CreateOilOrderForm.basicInfo.check,
promo_id: this.CreateOilOrderForm.basicInfo.promo_id,
credit_card_id: this.CreateOilOrderForm.basicInfo.userCards,
};
this.editOilOrder(payload);

View File

@@ -852,6 +852,34 @@ export default defineComponent({
.catch(() => {
});
},
CreateTransaction() {
let path = import.meta.env.VITE_MONEY_URL + "/delivery/add/" + this.deliveryOrder.id;
axios({
method: "post",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.status == 201) {
notify({
message: 'Confirmed Transaction',
type: 'positive',
position: 'top'
})
this.$router.push({ name: "today" });
}
else {
notify({
message: 'Form Error',
type: 'negative',
position: 'top'
})
}
})
},
FinalizeOrder(payload: {
cash: boolean,
card: boolean,
@@ -885,8 +913,9 @@ export default defineComponent({
text: "Ticket is finalized",
type: "success",
});
this.CreateTransaction()
this.$router.push({ name: "delivery" });
console.log("here")
}
if (response.data.error) {
notify({

View File

@@ -25,255 +25,319 @@
<div class="text-2xl border-b-2 border-gray-500 mb-10">
View Oil Order # {{ deliveryOrder.id }}
</div>
<div class="grid grid-cols-12">
<div class="col-span-6">
<div class="col-span-12 font-bold">
Customer
</div>
<div class="col-span-6 p-5 text-gray-500 text-sm">
<div class="grid grid-cols-12">
<div class="col-span-12 flex ">
{{ customer.account_number }}
</div>
<div class="col-span-12 flex">
{{ customer.customer_first_name }}
{{ customer.customer_last_name }}
</div>
<div class="col-span-12 flex ">
<div class="pr-2">
{{ customer.customer_town }},
</div>
<div class="pr-2">
<div v-if="customer.customer_state == 0">Massachusetts</div>
<div v-else-if="customer.customer_state == 1">Rhode Island</div>
<div v-else-if="customer.customer_state == 2">New Hampshire</div>
<div v-else-if="customer.customer_state == 3">Maine</div>
<div v-else-if="customer.customer_state == 4">Vermont</div>
<div v-else-if="customer.customer_state == 5">Maine</div>
<div v-else-if="customer.customer_state == 6">New York</div>
<div v-else>Unknown state</div>
</div>
<div class="pr-2">
{{ customer.customer_zip }}
</div>
</div>
<div class="col-span-12 flex" v-if="customer.customer_apt !== 'None'">
{{ customer.customer_apt }}
</div>
<div class="col-span-12 flex">
<div v-if="customer.customer_home_type == 0">Residential</div>
<div v-else-if="customer.customer_home_type == 1">apartment</div>
<div v-else-if="customer.customer_home_type == 2">condo</div>
<div v-else-if="customer.customer_home_type == 3">commercial</div>
<div v-else-if="customer.customer_home_type == 4">business</div>
<div v-else-if="customer.customer_home_type == 5">construction</div>
<div v-else-if="customer.customer_home_type == 6">container</div>
</div>
<div class="col-span-12 flex">
{{ customer.customer_phone_number }}
</div>
</div>
</div>
</div>
<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 btn-accent btn-sm">Edit Order</button>
</router-link>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-12">
<div class="col-span-6">
<div class="col-span-12 font-bold">
Delivery Status
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 font-bold">
Status
</div>
<div class="col-span-12 text-sm mb-5 text-gray-500">
<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 == 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 == 10">Finalized</div>
<div v-else></div>
</div>
<div class="col-span-12 font-bold ">
Scheduled date/time
</div>
<div class="col-span-12 mb-5 text-sm text-gray-500">
{{ deliveryOrder.expected_delivery_date }}
</div>
<div class="col-span-12 font-bold">
When Called
</div>
<div class="col-span-12 mb-5 text-sm text-gray-500">
{{ format_date(deliveryOrder.when_ordered) }}
</div>
<div class="col-span-12 font-bold">
When Delivered
</div>
<div class="col-span-12 mb-5 text-sm text-gray-500">
{{ format_date(deliveryOrder.when_delivered) }}
</div>
<div class="col-span-12 font-bold ">
Driver:
</div>
<div class="col-span-12 text-gray-500">
{{ deliveryOrder.driver_first_name }} {{ deliveryOrder.driver_last_name }}
</div>
</div>
</div>
<div class="col-span-6">
<div class="col-span-12 font-bold">
Amount
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm text-gray-500">
<div v-if="deliveryOrder.customer_asked_for_fill == 1">FILL</div>
<div v-else>{{ deliveryOrder.gallons_ordered }} gallons</div>
</div>
</div>
</div>
<div class="col-span-6 ">
<div class="col-span-12 font-bold">
Payment
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm">
<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-if="deliveryOrder.payment_type == 3">Check</div>
<div v-else-if="deliveryOrder.payment_type == 4">Check</div>
<div v-else>No Payment Type Added</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type == 1">
<div class="flex" v-if="userCardfound">
<div class="basis-1/3 p-2">
<div class="rounded-md border-2 bg-accent">
<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 }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type == 2">
<div class="flex" v-if="userCardfound">
<div class="basis-1/3 p-2">
<div class="bg-accent 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 }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type == 3">
<div class="flex" v-if="userCardfound">
<div class="basis-1/3 p-2">{{ userCard }}
<div class="bg-accent 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 }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-span-6 ">
<div class="col-span-12 font-bold">
Info
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-gray-500">
<div v-if="deliveryOrder.prime == 1">
Prime Required: Yes
</div>
<div v-if="deliveryOrder.prime == 0">
Prime Required: No
</div>
</div>
<div class="col-span-12 text-gray-500">
<div v-if="deliveryOrder.same_day == 1">
Same Day: Yes
</div>
<div v-if="deliveryOrder.same_day == 0">
Same Day: No
</div>
</div>
</div>
</div>
<div class="col-span-6 ">
<div class="col-span-12 font-bold">
Notes
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-gray-500">
{{ deliveryOrder.dispatcher_notes }}
</div>
</div>
<div class="col-span-6">
<a @click.prevent="deleteCall(deliveryOrder.id)">
<button class="btn btn-sm btn-error">Delete</button>
</a>
</div>
<div class="col-span-12 font-bold">
Customer
</div>
<div class="col-span-6 p-5 text-gray-500 text-sm">
<div class="grid grid-cols-12">
<div class="col-span-12 flex ">
{{ customer.account_number }}
</div>
<div class="col-span-12 flex">
{{ customer.customer_first_name }}
{{ customer.customer_last_name }}
</div>
<div class="col-span-12 flex ">
<div class="pr-2">
{{ customer.customer_town }},
</div>
<div class="pr-2">
<div v-if="customer.customer_state == 0">Massachusetts</div>
<div v-else-if="customer.customer_state == 1">Rhode Island</div>
<div v-else-if="customer.customer_state == 2">New Hampshire</div>
<div v-else-if="customer.customer_state == 3">Maine</div>
<div v-else-if="customer.customer_state == 4">Vermont</div>
<div v-else-if="customer.customer_state == 5">Maine</div>
<div v-else-if="customer.customer_state == 6">New York</div>
<div v-else>Unknown state</div>
</div>
<div class="pr-2">
{{ customer.customer_zip }}
</div>
</div>
<div class="col-span-12 flex" v-if="customer.customer_apt !== 'None'">
{{ customer.customer_apt }}
</div>
<div class="col-span-12 flex">
<div v-if="customer.customer_home_type == 0">Residential</div>
<div v-else-if="customer.customer_home_type == 1">apartment</div>
<div v-else-if="customer.customer_home_type == 2">condo</div>
<div v-else-if="customer.customer_home_type == 3">commercial</div>
<div v-else-if="customer.customer_home_type == 4">business</div>
<div v-else-if="customer.customer_home_type == 5">construction</div>
<div v-else-if="customer.customer_home_type == 6">container</div>
</div>
<div class="col-span-12 flex">
{{ customer.customer_phone_number }}
</div>
</div>
</div>
</div>
<div class="col-span-6 ">
</div>
</div>
<div class="grid grid-cols-12">
<div class="col-span-6">
<div class="col-span-12 font-bold">
Delivery Status
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 font-bold">
Status
</div>
<div class="col-span-12 text-sm mb-5 text-gray-500">
<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 == 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 == 10">Finalized</div>
<div v-else></div>
</div>
<div class="col-span-12 font-bold ">
Scheduled date/time
</div>
<div class="col-span-12 mb-5 text-sm text-gray-500">
{{ deliveryOrder.expected_delivery_date }}
</div>
<div class="col-span-12 font-bold">
When Called
</div>
<div class="col-span-12 mb-5 text-sm text-gray-500">
{{ format_date(deliveryOrder.when_ordered) }}
</div>
<div v-if="deliveryOrder.delivery_status == 10">
<div class="col-span-12 font-bold">
When Delivered
</div>
<div class="col-span-12 mb-5 text-sm text-gray-500">
{{ format_date(deliveryOrder.when_delivered) }}
</div>
</div>
<div class="col-span-12 font-bold ">
Driver:
</div>
<div class="col-span-12 text-gray-500">
{{ deliveryOrder.driver_first_name }} {{ deliveryOrder.driver_last_name }}
</div>
</div>
<div class="col-span-12 font-bold">
Info
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-gray-500">
<div v-if="deliveryOrder.prime == 1">
Prime Required: Yes
</div>
<div v-if="deliveryOrder.prime == 0">
Prime Required: No
</div>
</div>
<div class="col-span-12 text-gray-500">
<div v-if="deliveryOrder.same_day == 1">
Same Day: Yes
</div>
<div v-if="deliveryOrder.same_day == 0">
Same Day: No
</div>
</div>
</div>
</div>
<div class="col-span-6">
<div class="col-span-12 font-bold">
Gallons
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm text-gray-500">
<div v-if="deliveryOrder.customer_asked_for_fill == 1">FILL</div>
<div v-else>{{ deliveryOrder.gallons_ordered }} gallons</div>
</div>
</div>
<div v-if="deliveryOrder.delivery_status !== 10">
<div class="col-span-12 font-bold">
Promo
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm text-gray-500">
<div v-if="deliveryOrder.promo_id !== null">
<div class="">{{ promo.name_of_promotion }}</div>
<div class="">{{ promo.description }}</div>
<div class="">{{ promo.money_off_delivery }} off a gallon</div>
<div class="">{{ promo.text_on_ticket }}</div>
</div>
<div v-else>No Promo Added</div>
</div>
</div>
</div>
<div v-if="deliveryOrder.delivery_status !== 10">
<div class="col-span-12 font-bold">
Estimated Amount
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm text-gray-500">
<div class="col-span-12 text-gray-500">
<div v-if="deliveryOrder.customer_asked_for_fill == 1"> FILL (250)</div>
<div v-else> Gallons Ordered: {{ deliveryOrder.gallons_ordered }}</div>
</div>
<div v-if="deliveryOrder.promo_id !== null">
<div class="col-span-12 text-sm text-gray-500">
Before Discount: {{ total_amount }}
</div>
<div class="col-span-12 text-sm text-gray-500">
Discount Amount: ${{ discount }}
</div>
<div class="col-span-12 text-sm text-gray-500">
Promo Amount: ${{ total_amount_after_discount }}
</div>
</div>
<div v-else>
<div class="col-span-12 text-sm text-gray-500">
${{ total_amount }}
</div>
</div>
<div class="col-span-12 py-3" v-if="deliveryOrder.prime == 1">
Prime Fee: {{ pricing.price_prime }}
</div>
<div class="col-span-12 py-3" v-if="deliveryOrder.emergency == 1">
Emergency Fee: {{ pricing.price_emergency }}
</div>
<div class="col-span-12 py-3" v-if="deliveryOrder.same_day == 1">
Same Day: {{ pricing.price_same_day }}
</div>
</div>
</div>
</div>
<div v-if="deliveryOrder.delivery_status == 10">
<div class="col-span-12 font-bold" v-if="deliveryOrder.delivery_status == 10">
Finalized Amount
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm text-gray-500">
<div>{{ deliveryMoney.total_amount_oil }}</div>
</div>
</div>
</div>
<div class="col-span-12 font-bold">
Payment
</div>
<div class="grid grid-cols-12 p-5">
<div class="col-span-12 text-sm">
<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-if="deliveryOrder.payment_type == 3">Check</div>
<div v-else-if="deliveryOrder.payment_type == 4">Check</div>
<div v-else>No Payment Type Added</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type == 1">
<div class="flex" v-if="userCardfound">
<div class="basis-1/3 p-2">
<div class="rounded-md border-2 bg-accent">
<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 }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type == 2">
<div class="flex" v-if="userCardfound">
<div class="basis-1/3 p-2">
<div class="bg-accent 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 }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12" v-if="deliveryOrder.payment_type == 3">
<div class="flex" v-if="userCardfound">
<div class="basis-1/3 p-2">{{ userCard }}
<div class="bg-accent 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 }}
</div>
<div class="flex p-1 pl-4">
{{ userCard.expiration_month }}/ {{ userCard.expiration_year }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12 flex justify-center" v-if="deliveryOrder.id">
<router-link :to="{ name: 'deliveryEdit', params: { id: deliveryOrder.id } }">
<button class="btn btn-accent btn-sm">Edit Oil Order</button>
</router-link>
</div>
</div>
</div>
</div>
<Footer />
@@ -306,7 +370,12 @@ export default defineComponent({
user: {
id: 0
},
priceprime: 0,
pricesameday: 0,
priceemergency: 0,
total_amount: 0,
discount: 0,
total_amount_after_discount: 0,
deliveryNotesDriver: [],
userCardfound: false,
userCard: {
@@ -341,11 +410,29 @@ export default defineComponent({
time_added: '',
total_amount_oil: '',
total_amount_emergency: '',
total_amount_same_day: '',
total_amount_prime: '',
total_amount_fee: '',
total_discount_amount: '',
total_discount_total: '',
total_amount: '',
},
promo: {
id: 0,
name_of_promotion: '',
description: '',
money_off_delivery: '',
text_on_ticket: ''
},
pricing: {
price_from_supplier: 0,
price_for_customer: 0,
price_for_employee: 0,
price_same_day: 0,
price_prime: 0,
price_emergency: 0,
date: "",
},
deliveryOrder: {
id: '',
customer_id: 0,
@@ -370,11 +457,13 @@ export default defineComponent({
dispatcher_notes: '',
prime: 0,
same_day: 0,
emergency: 0,
payment_type: 0,
payment_card_id: '',
driver_employee_id: 0,
driver_first_name: '',
driver_last_name: '',
promo_id: 0,
},
}
},
@@ -386,11 +475,14 @@ export default defineComponent({
$route() {
this.getOilOrder(this.$route.params.id);
this.getOilOrderMoney(this.$route.params.id);
this.sumdelivery(this.$route.params.id);
},
},
mounted() {
this.getOilOrder(this.$route.params.id);
// this.getOilOrderMoney(this.$route.params.id);
this.getOilOrderMoney(this.$route.params.id);
this.sumdelivery(this.$route.params.id);
this.getOilPricing()
},
methods: {
@@ -437,6 +529,24 @@ export default defineComponent({
}
})
},
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;
})
.catch(() => {
notify({
title: "Error",
text: "Could not get oil pricing",
type: "error",
});
});
},
getCustomer(user_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/customer/" + user_id;
axios({
@@ -456,32 +566,28 @@ export default defineComponent({
});
},
getPaymentCard(card_id: any) {
if (card_id){
let path = import.meta.env.VITE_BASE_URL + "/payment/card/" + card_id;
axios({
method: "get",
url: path,
withCredentials: true,
})
.then((response: any) => {
if (response.data.userCard.card_number === ''){
this.userCard === null;
this.userCardfound = false;
}
else{
this.userCard = response.data;
this.userCardfound = true;
}
if (card_id) {
let path = import.meta.env.VITE_BASE_URL + "/payment/card/" + card_id;
axios({
method: "get",
url: path,
withCredentials: true,
})
.catch(() => {
});
.then((response: any) => {
if (response.data.userCard.card_number === '') {
this.userCard === null;
this.userCardfound = false;
}
else {
this.userCard = response.data;
this.userCardfound = true;
}
})
.catch(() => {
});
}
else{
else {
this.userCardfound = false;
}
},
@@ -507,6 +613,10 @@ export default defineComponent({
if (this.deliveryOrder.payment_type == 3) {
this.getPaymentCard(this.deliveryOrder.payment_card_id);
}
if (this.deliveryOrder.promo_id != null) {
this.getPromo(this.deliveryOrder.promo_id);
}
}
})
},
@@ -524,7 +634,49 @@ export default defineComponent({
}
})
},
sumdelivery(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/total/" + delivery_id;
axios({
method: "get",
url: path,
withCredentials: true,
})
.then((response: any) => {
if (response.data.ok) {
this.priceprime = response.data.priceprime;
this.pricesameday = response.data.pricesameday;
this.priceemergency = response.data.priceemergency;
this.total_amount = response.data.total_amount;
this.discount = response.data.discount;
this.total_amount_after_discount = response.data.total_amount_after_discount;
}
})
.catch(() => {
notify({
title: "Error",
text: "Could not get oil pricing",
type: "error",
});
});
},
getPromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/promo/" + promo_id;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
this.promo = response.data
}
})
},
},
})
</script>

View File

@@ -92,7 +92,6 @@
</div>
</div>
</div>
</div>
@@ -143,13 +142,52 @@
</div>
<div class="grid grid-cols-12 mb-5">
<div class="col-span-12 pt-3 font-bold">
Price / Gallon:
Payment Type:
</div>
<div class="col-span-12 text-gray-500">
{{ delivery.customer_price }}
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 0">
Cash
</div>
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 1">
Credit Card
</div>
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 2">
Credit Card / Cash
</div>
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 3">
Check with CC Hold
</div>
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 4">
Other (Rent, etc):
</div>
<div v-if="promo_active">
<div class="col-span-12 pt-3 font-bold">
Promo
</div>
<div class="col-span-12 text-gray-500">
{{ promo.name_of_promotion }}
</div>
<div class="col-span-12 pt-3 font-bold">
Promo Discount:
</div>
<div class="col-span-12 text-gray-500">
{{ promo.money_off_delivery }} off a gallon
</div>
<div class="col-span-12 text-gray-500">
{{ discount }} off total delivery
</div>
<div class="col-span-12 text-gray-500">
{{ total_amount_after_discount }} total price after discount
</div>
<div class="col-span-12 pt-3 font-bold">
Price / Gallon:
</div>
<div class="col-span-12 text-gray-500">
{{ delivery.customer_price }} ({{ delivery.customer_price - promo.money_off_delivery}})
</div>
</div>
<div class="col-span-12 pt-3 font-bold">
@@ -171,6 +209,30 @@
Same Day: {{ pricing.price_same_day }}
</div>
<div class="col-span-12 py-3" v-if="delivery.promo_id != 0">
<div class="col-span-12 font-bold py-5 " v-if="delivery.payment_type == 0">
<div class="">
CASH Total: ${{ total_amount_after_discount }}
</div>
</div>
<div class="col-span-12 font-bold py-5 text-accent" v-if="delivery.payment_type == 1">
<div class="">
Pre Charge Credit Card Total: ${{ total_amount_after_discount }}
</div>
</div>
<div class="col-span-12 font-bold py-5 text-accent" v-if="delivery.payment_type == 2">
<div class="">
Pre Charge Credit Card Total: ${{ total_amount_after_discount }}
</div>
</div>
<div class="col-span-12 font-bold py-5 text-accent" v-if="delivery.payment_type == 3">
<div class="">
Check - Pre Charge Credit Card Total: ${{ total_amount_after_discount }}
</div>
</div>
</div>
<div class="col-span-12 py-3" v-else>
<div class="col-span-12 font-bold py-5 " v-if="delivery.payment_type == 0">
<div class="">
CASH Total: ${{ total_amount }}
@@ -192,10 +254,11 @@
</div>
</div>
</div>
</div>
<div class="flex justify-between">
<!-- <button class="btn" @click="checkoutOilCreditStripe()">-->
<!-- Pay Credit Card (Stripe)-->
<!-- </button>-->
<div class="" v-if="delivery.payment_type == 0">
<button class="btn btn-accent btn-sm" @click="checkoutOilUpdatePayment(0)">
Confirm Cash Payment
@@ -282,6 +345,7 @@ export default defineComponent({
customer_temperature: 0,
dispatcher_notes: '',
prime: 0,
promo_id: 0,
emergency: 0,
same_day: 0,
payment_type: 0,
@@ -332,10 +396,19 @@ export default defineComponent({
price_emergency: 0,
date: "",
},
promo_active: false,
promo: {
name_of_promotion: '',
description: '',
money_off_delivery: 0,
text_on_ticket: ''
},
priceprime: 0,
pricesameday: 0,
priceemergency: 0,
total_amount: 0,
discount: 0,
total_amount_after_discount: 0,
}
},
validations() {
@@ -361,7 +434,6 @@ export default defineComponent({
this.getOilOrder(this.$route.params.id)
this.sumdelivery(this.$route.params.id);
this.getOilPricing()
// this.getStripePublishableKey();
},
@@ -379,6 +451,8 @@ export default defineComponent({
this.pricesameday = response.data.pricesameday;
this.priceemergency = response.data.priceemergency;
this.total_amount = response.data.total_amount;
this.discount = response.data.discount;
this.total_amount_after_discount = response.data.total_amount_after_discount;
}
})
.catch(() => {
@@ -389,7 +463,21 @@ export default defineComponent({
});
});
},
getPromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/promo/" + promo_id;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
this.promo = response.data
}
})
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
@@ -414,9 +502,6 @@ export default defineComponent({
})
.then((response: any) => {
this.pricing = response.data;
})
.catch(() => {
notify({
@@ -437,7 +522,10 @@ export default defineComponent({
this.delivery = response.data;
this.getCustomer(this.delivery.customer_id)
this.getCreditCards(this.delivery.customer_id)
if (this.delivery.promo_id != null) {
this.getPromo(this.delivery.promo_id);
this.promo_active = true;
}
})
.catch(() => {
notify({
@@ -468,31 +556,6 @@ export default defineComponent({
this.customer = response.data
})
},
checkoutOilUpdateCreditStripe() {
let path = import.meta.env.VITE_BASE_URL + "/delivery/cash/" + this.delivery.id + '/2';
axios({
method: "PUT",
url: path,
})
.then((response: any) => {
if (response.data.ok) {
notify({
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) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/cash/" + this.delivery.id + '/' + payment_type;
axios({
@@ -542,45 +605,7 @@ export default defineComponent({
});
},
// checkoutOilCreditStripe() {
//
// let path = import.meta.env.VITE_PAY_URL + "/pay/charge";
// axios({
// method: "get",
// url: path,
// })
// .then((response: any) => {
// this.checkoutOilUpdateCreditStripe();
// // Redirect to Stripe Checkout
// return this.stripe.redirectToCheckout({sessionId: response.data.sessionId});
// })
// .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

@@ -28,69 +28,94 @@
</div>
</div>
<div class="grid grid-cols-12 pl-6 pb-20 ">
<div class="grid grid-cols-12 pl-6 pb-8 ">
<div class="col-span-12 ">{{ delivery.dispatcher_notes }}</div>
<div class="col-span-12 ">{{ customer_description.description }}</div>
<div class="col-span-12 " v-if="delivery.promo_id !== null">Promo: {{ promo.text_on_ticket }}</div>
<div class="col-span-12 "></div>
<div class="col-span-12 " v-if="delivery.prime == 1">PRIME</div>
<div class="col-span-12 " v-if="delivery.same_day == 1">SAME DAY</div>
<div class="col-span-12 " v-if="delivery.emergency == 1">EMERGENCY</div>
<div class="col-span-12 text-lg" v-if="delivery.payment_type == 0">CASH</div>
<div class="col-span-12 text-lg" v-else-if="delivery.payment_type == 1">Credit Card</div>
<div class="col-span-12 text-lg" v-else-if="delivery.payment_type == 2">Credit Card/Cash</div>
<div class="col-span-12 text-lg" v-else-if="delivery.payment_type == 3">Check</div>
<div class="col-span-12 text-lg" v-else-if="delivery.payment_type == 4">Other</div>
<div class="col-span-12" v-else></div>
</div>
<div class="grid grid-cols-12">
<div class="col-span-6 ">
<div class="col-span-12 pl-5">Auburn Oil
</div>
<div class="col-span-12 pl-5">PO BOX 123</div>
<div class="col-span-8 pl-5">
<div class="grid grid-cols-12">
<div class="col-span-5"> Auburn</div>
<div class="col-span-3">
Ma
</div>
<div class="col-span-4">01501 </div>
</div>
</div>
</div>
<div class="col-span-6 ">
<div v-if="past_deliveries1.length > 1">
<div class="col-span-6" v-for="past_delivery in past_deliveries1">
<div class="">
{{ past_delivery.when_delivered }} - {{ past_delivery.gallons_delivered }}
<div class="col-span-12 pl-5">Auburn Oil</div>
<div class="col-span-12 pl-5">PO BOX 123</div>
<div class="col-span-8 pl-5">
<div class="grid grid-cols-12">
<div class="col-span-5"> Auburn</div>
<div class="col-span-3">
Ma
</div>
<div class="col-span-4">01501 </div>
</div>
</div>
<div class="col-span-12 pl-5">508 426 8800</div>
</div>
<div v-else >
<div class="col-span-6 ">
<div v-if="past_deliveries1.length > 1">
<div class="col-span-6" v-for="past_delivery in past_deliveries1">
<div class="">
{{ past_delivery.when_delivered }} - {{ past_delivery.gallons_delivered }}
</div>
</div>
</div>
<div v-else>
<div class="col-span-6 text-center">Have a Great day :)</div>
</div>
</div>
</div>
</div>
<div class="col-span-6 ">
<div class="col-span-4 ">
<div class="grid grid-cols-12 ">
<div class="col-span-12 h-7 pl-4 pt-2">{{ delivery.when_ordered }}</div>
<div class="col-span-12 h-7 pl-4 pt-2">{{ delivery.expected_delivery_date }}</div>
<div class="col-span-12 h-7 pl-4 pt-2" v-if="delivery.customer_asked_for_fill == 0 ">{{ delivery.gallons_ordered }}</div>
<div class="col-span-12 h-7 pl-4 pt-2" v-if="delivery.customer_asked_for_fill == 0">{{
delivery.gallons_ordered }}</div>
<div class="col-span-12 h-7 pl-4 pt-2" v-else></div>
<div class="col-span-12 h-7 pl-4 pt-2">{{ delivery.customer_price }} </div>
<div class="col-span-12 h-7 pl-4 pt-4" v-if="delivery.customer_asked_for_fill == 0 ">{{ total_amount }} </div>
<div class="col-span-12 h-7 pl-4 pt-2" v-if="promo_active">
<div class="flex gap-2">
<div class="line-through"> {{ delivery.customer_price }}</div> ({{
delivery.customer_price - promo.money_off_delivery}})
</div>
</div>
<div class="col-span-12 h-7 pl-4 pt-2" v-else>{{ delivery.customer_price }}</div>
<div class="col-span-12 h-7 pl-4 pt-4" v-if="delivery.customer_asked_for_fill == 0">{{
total_amount }} </div>
<div class="col-span-12 h-7 pl-4 pt-4" v-else></div>
<div class="col-span-12 h-7 pt-6"></div>
<div class="col-span-12 h-7"></div>
<div class="col-span-12 h-7 pl-8"></div>
</div>
</div>
</div>
</div>
</div>
</template>
@@ -153,7 +178,7 @@ export default defineComponent({
automatic: 0,
oil_id: 0,
supplier_price: '',
customer_price: '',
customer_price: 0,
customer_temperature: '',
dispatcher_notes: '',
prime: 0,
@@ -164,6 +189,7 @@ export default defineComponent({
driver_employee_id: 0,
driver_first_name: '',
driver_last_name: '',
promo_id: 0,
},
customer: {
id: 0,
@@ -187,9 +213,20 @@ export default defineComponent({
fill_location: 0,
description: '',
},
promo_active: false,
promo: {
id: 0,
name_of_promotion: '',
description: '',
money_off_delivery: 0,
text_on_ticket: ''
},
priceprime: 0,
pricesameday: 0,
priceemergency: 0,
total_amount: 0,
discount: 0,
total_amount_after_discount: 0,
}
},
@@ -220,6 +257,10 @@ export default defineComponent({
.then((response: any) => {
this.delivery = response.data;
this.getCustomer(this.delivery.customer_id)
if (this.delivery.promo_id != null) {
this.getPromo(this.delivery.promo_id);
this.promo_active = true;
}
})
.catch(() => {
@@ -287,7 +328,6 @@ export default defineComponent({
headers: authHeader(),
}).then((response: any) => {
this.past_deliveries1 = response.data
console.log(this.past_deliveries1);
})
},
getPastDeliveries2(userid: any) {
@@ -300,6 +340,21 @@ export default defineComponent({
this.past_deliveries2 = response.data
})
},
getPromo(promo_id: any) {
let path = import.meta.env.VITE_BASE_URL + "/promo/" + promo_id;
axios({
method: "get",
url: path,
withCredentials: true,
headers: authHeader(),
})
.then((response: any) => {
if (response.data) {
this.promo = response.data
// this.delivery.promo_id = this.promo.id
}
})
},
},
})
</script>