updated customer profile. added maps

This commit is contained in:
2024-11-20 18:00:17 -05:00
parent b62d45da5d
commit bf49bf5711
19 changed files with 1157 additions and 313 deletions

View File

@@ -22,17 +22,23 @@
<div class="w-full mt-10">
<div class="grid grid-cols-12 gap-5">
<div class="col-span-4 p-5 ">
<div class="col-span-6 p-5 ">
<div class="grid grid-cols-12 gap-5">
<div class="col-span-12 font-bold text-3xl ">
{{ customer.account_number }}
</div>
<div class="col-span-12 font-bold ">
<img src="../../../assets/images/user_placeholder.png" alt="Drone Image" width="200" height="250" />
<div style="height:400px; width:100%">
<l-map ref="map" v-model:zoom="zoom"
:center="[customer.customer_latitude, customer.customer_longitude]">
<l-tile-layer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" layer-type="base"
name="OpenStreetMap"></l-tile-layer>
</l-map>
</div>
</div>
</div>
</div>
<div class="col-span-8 p-5">
<div class="col-span-6 p-5">
<div class="grid grid-cols-12 ">
<div class="col-span-12 font-bold flex justify-evenly pb-5">
@@ -59,67 +65,126 @@
</div>
<div class="col-span-12">
<div class="grid grid-cols-12">
<div class="col-span-6 ">
<div class="col-span-12 font-bold flex pb-5 text-lg" v-if="automatic_status === 1">Automatic
<div class="col-span-6">
<div class="col-span-12 font-bold flex pb-5 text-lg text-red-600"
v-if="customer.correct_address === false">
Possible Incorrect Address!!
</div>
<div class="col-span-12 font-bold flex pb-5 text-lg" v-if="automatic_status === 1">
Automatic
</div>
<div class="col-span-12 font-bold flex pb-5 text-lg" v-else>Will Call</div>
<div class="col-span-12 font-bold flex">
{{ customer.customer_first_name }}
{{ customer.customer_last_name }}
<div class="col-span-12 font-bold flex pb-5 text-lg" v-else>
Will Call
</div>
<div class="col-span-12 font-bold flex">
{{ customer.customer_address }}
<div v-if="customer.customer_apt != 'None'">
<div class="text-green-600" v-if="automatic_status === 1">
<div class="col-span-12 font-bold flex">
{{ customer.customer_first_name }}
{{ customer.customer_last_name }}
</div>
<div class="col-span-12 font-bold flex">
{{ customer.customer_address }}
</div>
<div class="col-span-12 font-bold 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 font-bold flex" v-if="customer.customer_apt !== ''">
{{ customer.customer_apt }}
</div>
</div>
<div class="col-span-12 font-bold flex">
<div class="pr-2">
{{ customer.customer_town }},
<div class="col-span-12 font-bold 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="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 class="col-span-12 font-bold flex">
{{ customer.customer_phone_number }}
</div>
</div>
<div class="" v-else>
<div class="col-span-12 font-bold flex">
{{ customer.customer_first_name }}
{{ customer.customer_last_name }}
</div>
<div class="col-span-12 font-bold flex">
{{ customer.customer_address }}
</div>
<div class="col-span-12 font-bold flex" v-if="customer.customer_apt !== 'None'">
{{ customer.customer_apt }}
</div>
<div class="col-span-12 font-bold 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 font-bold flex">
{{ customer.customer_phone_number }}
</div>
<div class="col-span-12 font-bold 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 font-bold flex" v-if="customer.customer_apt !== ''">
{{ customer.customer_apt }}
</div>
<div class="col-span-12 font-bold 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 font-bold flex">
{{ customer.customer_phone_number }}
</div>
</div>
</div>
<div class="col-span-6">
<div class="col-span-12 py-2 px-2 text-orange-600 "
v-if="customer_tank.outside_or_inside == false">
<div v-if="customer_tank.last_tank_inspection !== null">
OUTSIDE TANK - {{ customer_tank.tank_size }}
</div>
</div>
<div class="col-span-12 py-2 px-2" v-if="customer_tank.outside_or_inside == true">
{{ customer_tank.tank_size }}
</div>
<div class="col-span-12 font-bold">Home Description</div>
<div class="col-span-12 py-2 px-2">
{{ customer_description.description }}
</div>
</div>
</div>
</div>
@@ -139,7 +204,6 @@
<div class="col-span-12 py-2 px-2">
Total Calls: {{ customer_stats.total_calls }}
</div>
</div>
</div>
</div>
@@ -198,6 +262,16 @@
<div class="col-span-12 py-2 px-2" v-else>
Inspected
</div>
<div class="col-span-12 py-2 font-bold">Inside/Outside </div>
<div class="col-span-12 py-2 px-2 " v-if="customer_tank.outside_or_inside == true">
Inside
</div>
<div class="col-span-12 py-2 px-2 text-orange-600" v-else>
Outside
</div>
</div>
@@ -211,12 +285,12 @@
<div class="col-span-12 py-2 px-2">
{{ customer_tank.tank_size }}
</div>
</div>
</div>
</div>
</div>
<div class="col-span-12 ">
<hr class=" h-1 mx-auto my-4 bg-gray-800 border-0 rounded dark:bg-gray-400">
</div>
@@ -227,7 +301,7 @@
</div>
<div class="col-span-6 font-bold flex ">
<router-link :to="{ name: 'cardadd', params: { id: customer.user_id } }">
<button class="btn btn-sm btn-secondary text-white">Add Credit Card</button>
<button class="btn btn-sm bg-gray-700 text-white">Add Credit Card</button>
</router-link>
</div>
<div class="col-span-12 font-bold flex">
@@ -252,27 +326,31 @@
{{ card.card_number }}
</div>
<div class="flex p-1 pl-4">
<div v-if="card.expiration_month == 1">01</div>
<div v-if="card.expiration_month == 2">02</div>
<div v-if="card.expiration_month == 3">03</div>
<div v-if="card.expiration_month == 4">04</div>
<div v-if="card.expiration_month == 5">05</div>
<div v-if="card.expiration_month == 6">06</div>
<div v-if="card.expiration_month == 7">07</div>
<div v-if="card.expiration_month == 8">08</div>
<div v-if="card.expiration_month == 9">09</div>
<div v-if="card.expiration_month == 10">10</div>
<div v-if="card.expiration_month == 11">11</div>
<div v-if="card.expiration_month == 12">12</div>
<div v-if="card.expiration_month == 1">01</div>
<div v-if="card.expiration_month == 2">02</div>
<div v-if="card.expiration_month == 3">03</div>
<div v-if="card.expiration_month == 4">04</div>
<div v-if="card.expiration_month == 5">05</div>
<div v-if="card.expiration_month == 6">06</div>
<div v-if="card.expiration_month == 7">07</div>
<div v-if="card.expiration_month == 8">08</div>
<div v-if="card.expiration_month == 9">09</div>
<div v-if="card.expiration_month == 10">10</div>
<div v-if="card.expiration_month == 11">11</div>
<div v-if="card.expiration_month == 12">12</div>
<div class=" pl-1 pr-1">/ </div>
<div class=""> {{ card.expiration_year }} </div>
</div>
<div class="flex p-1 pl-4">
{{ card.zip_code }}
</div>
<div class="flex p-1 pl-4">
{{ card.security_number }}
</div>
<div class="flex justify-between">
<a @click.prevent="editCard(card.id)" class="cursor-pointer underline hover:text-blue-300">
@@ -297,23 +375,23 @@
{{ card.card_number }}
</div>
<div class="flex p-1 pl-4">
<div v-if="card.expiration_month == 1">01</div>
<div v-if="card.expiration_month == 2">02</div>
<div v-if="card.expiration_month == 3">03</div>
<div v-if="card.expiration_month == 4">04</div>
<div v-if="card.expiration_month == 5">05</div>
<div v-if="card.expiration_month == 6">06</div>
<div v-if="card.expiration_month == 7">07</div>
<div v-if="card.expiration_month == 8">08</div>
<div v-if="card.expiration_month == 9">09</div>
<div v-if="card.expiration_month == 10">10</div>
<div v-if="card.expiration_month == 11">11</div>
<div v-if="card.expiration_month == 12">12</div>
<div v-if="card.expiration_month == 1">01</div>
<div v-if="card.expiration_month == 2">02</div>
<div v-if="card.expiration_month == 3">03</div>
<div v-if="card.expiration_month == 4">04</div>
<div v-if="card.expiration_month == 5">05</div>
<div v-if="card.expiration_month == 6">06</div>
<div v-if="card.expiration_month == 7">07</div>
<div v-if="card.expiration_month == 8">08</div>
<div v-if="card.expiration_month == 9">09</div>
<div v-if="card.expiration_month == 10">10</div>
<div v-if="card.expiration_month == 11">11</div>
<div v-if="card.expiration_month == 12">12</div>
<div class=" pl-1 pr-1">/ </div>
<div class=""> {{ card.expiration_year }} </div>
</div>
<div class="flex p-1 pl-4">
{{ card.zip_code }}
@@ -335,7 +413,7 @@
</div>
</div>
</div>
@@ -345,8 +423,7 @@
<div class="col-span-6 px-4">
<div class="grid grid-cols-12">
<form class="rounded-md col-span-12" enctype="multipart/form-data"
@submit.prevent="onSubmitSocial">
<form class="rounded-md col-span-12" enctype="multipart/form-data" @submit.prevent="onSubmitSocial">
<div class="mb-4">
<label class="block text-white text-sm font-bold mb-2">Customer Comment</label>
@@ -407,9 +484,11 @@
<tr>
<th>id</th>
<th>Status</th>
<th>Town</th>
<th>Name</th>
<th>Address</th>
<th>Town</th>
<th>Gallons</th>
<th>Date</th>
@@ -422,23 +501,22 @@
<td>{{ oil['id'] }}</td>
<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'] == 1">cancelled</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'] == 3">Tommorrow</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_name'] }}</td>
<td>{{ oil['customer_address'] }}</td>
<td>{{ oil['customer_town'] }}</td>
<td v-if="oil['delivery_status'] != 10">
<div v-if="oil['customer_asked_for_fill'] == 1">Fill</div>
<div v-else> {{ oil['gallons_ordered'] }}</div>
</td>
<td v-else>
{{oil['gallons_delivered']}}
{{ oil['gallons_delivered'] }}
</td>
<td>{{ oil['expected_delivery_date'] }}</td>
@@ -491,6 +569,9 @@ import SideBar from '../../../layouts/sidebar/sidebar.vue'
import Footer from '../../../layouts/footers/footer.vue'
import PaginationComp from "../../../components/pagination.vue";
import { notify } from "@kyvg/vue3-notification";
import "leaflet/dist/leaflet.css";
import { LMap, LTileLayer } from "@vue-leaflet/vue-leaflet";
export default defineComponent({
name: 'CustomerProfile',
@@ -499,10 +580,13 @@ export default defineComponent({
Header,
SideBar,
Footer,
LMap,
LTileLayer,
},
data() {
return {
zoom: 14,
token: null,
user: {
user_id: 0,
@@ -518,8 +602,8 @@ export default defineComponent({
{
id: 0,
created: '',
customer_id: '',
poster_employee_id: '',
customer_id: 0,
poster_employee_id: 0,
comment: '',
}
],
@@ -557,6 +641,9 @@ export default defineComponent({
customer_apt: '',
customer_home_type: 0,
customer_phone_number: '',
customer_latitude: 0,
customer_longitude: 0,
correct_address: true,
account_number: '',
},
customer_description: {
@@ -581,7 +668,6 @@ export default defineComponent({
service_calls_total: 0,
service_calls_total_spent: 0,
service_calls_total_profit: 0,
oil_deliveries: 0,
oil_total_gallons: 0,
oil_total_spent: 0,
@@ -632,7 +718,6 @@ export default defineComponent({
.then((response: any) => {
if (response.data.ok) {
this.user = response.data.user;
console.log(this.user)
}
})
.catch(() => {
@@ -721,7 +806,7 @@ export default defineComponent({
}).then((response: any) => {
this.customer_last_delivery = response.data.date
console.log(response.data)
})
},
getCustomerStats(userid: any) {
@@ -742,11 +827,8 @@ export default defineComponent({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
console.log(response)
console.log("updated gallons")
})
},
getCustomerDescription(userid: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/description/' + userid;
@@ -767,6 +849,7 @@ export default defineComponent({
headers: authHeader(),
}).then((response: any) => {
this.customer_tank = response.data
})
},