added print button and finalize
This commit is contained in:
@@ -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",
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
//
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user