major update
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<div class="col-span-12 text-2xl">Edit customer: {{ customer.account_number }}</div>
|
||||
<div class="col-span-12 py-5">
|
||||
<router-link :to="{ name: 'customerProfile', params: { id: customer['id'] } }"
|
||||
class=" btn btn-accent btn-sm">
|
||||
class="btn btn-secondary btn-sm">
|
||||
View Profile
|
||||
</router-link>
|
||||
</div>
|
||||
@@ -128,7 +128,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0">
|
||||
<label class="block text-white text-sm font-bold mb-2">Email</label>
|
||||
<input v-model="CreateCustomerForm.basicInfo.customer_email"
|
||||
@@ -138,17 +137,21 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0 mt-5">
|
||||
<label class="block text-white text-sm font-bold mb-2">Automatic</label>
|
||||
<input v-model="CreateCustomerForm.basicInfo.customer_automatic" class="checkbox" type="checkbox" />
|
||||
</div>
|
||||
|
||||
<div class="text-[18px] mt-5 mb-5"> Description</div>
|
||||
|
||||
<div class="col-span-12 md:col-span-4 mb-2 ">
|
||||
<label class="block text-white text-sm font-bold mb-2">Fill Location</label>
|
||||
<input v-model="CreateCustomerForm.basicInfo.customer_fill_location"
|
||||
class="input input-bordered input-sm w-full max-w-xs" id="fill" type="text" placeholder="Fill" />
|
||||
</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>
|
||||
@@ -206,7 +209,7 @@ export default defineComponent({
|
||||
customer_phone_number: '',
|
||||
account_number: '',
|
||||
},
|
||||
customer_description_overall: {
|
||||
customerDescription: {
|
||||
id: 0,
|
||||
customer_id: 0,
|
||||
account_number: '',
|
||||
@@ -228,6 +231,7 @@ export default defineComponent({
|
||||
customer_state: "",
|
||||
customer_address: "",
|
||||
customer_description: "",
|
||||
customer_fill_location: 0,
|
||||
|
||||
},
|
||||
},
|
||||
@@ -293,10 +297,9 @@ export default defineComponent({
|
||||
headers: authHeader(),
|
||||
}).then((response: any) => {
|
||||
|
||||
this.customer_description_overall = response.data
|
||||
console.log(response.data)
|
||||
this.CreateCustomerForm.basicInfo.customer_description = response.data.description;
|
||||
console.log(this.CreateCustomerForm.basicInfo.customer_description )
|
||||
this.customerDescription = response.data
|
||||
this.CreateCustomerForm.basicInfo.customer_description = this.customerDescription.description;
|
||||
this.CreateCustomerForm.basicInfo.customer_fill_location =this.customerDescription.fill_location
|
||||
})
|
||||
},
|
||||
|
||||
@@ -350,6 +353,7 @@ export default defineComponent({
|
||||
customer_state: string;
|
||||
customer_address: string;
|
||||
customer_description: string;
|
||||
customer_fill_location: number;
|
||||
}) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/customer/edit/" + this.customer.id;
|
||||
axios({
|
||||
@@ -382,7 +386,7 @@ export default defineComponent({
|
||||
customer_home_type: this.CreateCustomerForm.basicInfo.customer_home_type,
|
||||
customer_state: this.CreateCustomerForm.basicInfo.customer_state,
|
||||
customer_address: this.CreateCustomerForm.basicInfo.customer_address,
|
||||
|
||||
customer_fill_location: this.CreateCustomerForm.basicInfo.customer_fill_location,
|
||||
customer_description: this.CreateCustomerForm.basicInfo.customer_description,
|
||||
};
|
||||
this.editItem(payload);
|
||||
|
||||
@@ -24,7 +24,15 @@
|
||||
Customers {{ customer_count }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-span-12 bg-secondary">
|
||||
<div class="grid grid-cols-12 p-5 bg-neutral m-5">
|
||||
<div class="col-span-12 font-bold text-xl">Quick Tips</div>
|
||||
<div class="col-span-3 py-2"> @ = last name search</div>
|
||||
<div class="col-span-3 py-2"> ! = address</div>
|
||||
<div class="col-span-3 py-2"> # = phone number</div>
|
||||
<div class="col-span-3 py-2"> $ = account number</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-auto bg-neutral font-bold">
|
||||
<table class="table">
|
||||
<!-- head -->
|
||||
@@ -41,7 +49,10 @@
|
||||
<tbody>
|
||||
<!-- 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['account_number'] }}
|
||||
</router-link>
|
||||
</td>
|
||||
<td>
|
||||
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }">
|
||||
{{ person['customer_first_name'] }} {{ person['customer_last_name'] }}
|
||||
@@ -56,17 +67,17 @@
|
||||
|
||||
<td class="flex gap-5">
|
||||
<router-link :to="{ name: 'deliveryCreate', params: { id: person['id'] } }"
|
||||
class="btn btn-accent btn-sm">
|
||||
Create Oil Order
|
||||
class="btn-sm btn bg-orange-600 text-white">
|
||||
Create Delivery
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'customerEdit', params: { id: person['id'] } }" class="btn btn-accent btn-sm">
|
||||
<router-link :to="{ name: 'customerEdit', params: { id: person['id'] } }" class="btn-sm btn btn-secondary">
|
||||
Edit Customer
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'cardadd', params: { id: person['id'] } }">
|
||||
<button class="btn btn-sm btn-accent">Add CreditCard</button>
|
||||
<button class="btn btn-sm btn-secondary text-white ">Add CreditCard</button>
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'customerProfile', params: { id: person['id'] } }"
|
||||
class=" btn btn-accent btn-sm">
|
||||
class="btn btn-secondary btn-sm">
|
||||
View Profile
|
||||
</router-link>
|
||||
|
||||
|
||||
@@ -22,39 +22,46 @@
|
||||
<div class="w-full mt-10">
|
||||
|
||||
<div class="grid grid-cols-12 gap-5">
|
||||
<div class="col-span-4 p-5 ">
|
||||
<img src="../../../assets/images/user_placeholder.png" alt="Drone Image" width="200" height="250" />
|
||||
<div class="col-span-4 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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-8 p-5">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-12 font-bold flex justify-evenly pb-5">
|
||||
|
||||
<router-link :to="{ name: 'deliveryCreate', params: { id: customer.id } }"
|
||||
class="btn-sm btn btn-accent">
|
||||
class="btn-sm btn bg-orange-600 text-white">
|
||||
Create Delivery
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'customerEdit', params: { id: customer.id } }"
|
||||
class="btn-sm btn btn-accent">
|
||||
class="btn-sm btn btn-secondary">
|
||||
Edit Customer
|
||||
</router-link>
|
||||
|
||||
|
||||
<div v-if="automatic_status === 0">
|
||||
<button v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
|
||||
Become Automatic Customer
|
||||
</button>
|
||||
<button v-on:click="userAutomatic(customer.id)" class="btn-sm btn btn-secondary">
|
||||
Become Automatic Customer
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
|
||||
<button v-on:click="userAutomatic(customer.id)" class="btn bg-green-600 text-black btn-sm">
|
||||
Become Will Call Customer
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</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-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 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 }}
|
||||
@@ -101,42 +108,43 @@
|
||||
<div class="col-span-12 font-bold flex">
|
||||
{{ customer.customer_phone_number }}
|
||||
</div>
|
||||
<div class="col-span-12 font-bold flex">{{ customer.account_number }}</div>
|
||||
|
||||
<div class="col-span-12 pt-10 font-bold">Home Description</div>
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
{{ customer_description.description }}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-span-12 ">
|
||||
<hr class=" h-1 mx-auto my-4 bg-gray-100 border-0 rounded dark:bg-gray-400">
|
||||
<hr class=" h-1 mx-auto my-4 bg-gray-800 border-0 rounded dark:bg-gray-400">
|
||||
</div>
|
||||
<div class="col-span-6 ">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-12 font-bold flex text-2xl">
|
||||
Description
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-12 py-2 font-bold">Home Description</div>
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
{{ customer_description.description }}
|
||||
</div>
|
||||
<div class="col-span-12 py-2 font-bold">Fill Location</div>
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
{{ customer_description.fill_location }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 ">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-12 font-bold flex text-2xl">
|
||||
Stats
|
||||
Stats
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
Total Calls: {{ customer_stats.total_calls }}
|
||||
</div>
|
||||
<div class="col-span-12 py-2 font-bold">Delivery</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 ">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-12 font-bold flex text-2xl">
|
||||
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
Total Delivery Orders: {{ customer_stats.oil_deliveries }}
|
||||
</div>
|
||||
@@ -150,8 +158,69 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-span-12 ">
|
||||
<hr class=" h-1 mx-auto my-4 bg-gray-100 border-0 rounded dark:bg-gray-400">
|
||||
<hr class=" h-1 mx-auto my-4 bg-gray-800 border-0 rounded dark:bg-gray-400">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-span-6 ">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-12 font-bold flex text-2xl">
|
||||
Tank
|
||||
</div>
|
||||
<div class="col-span-6">
|
||||
<div class="col-span-12 py-2 font-bold">Last Tank Inspection </div>
|
||||
<div class="col-span-12 py-2 px-2 text-red-600" v-if="customer_tank.last_tank_inspection == null">
|
||||
Not inspected
|
||||
</div>
|
||||
<div class="col-span-12 py-2 px-2" v-else>
|
||||
{{ customer_tank.last_tank_inspection }}
|
||||
</div>
|
||||
|
||||
<div class="col-span-12 py-2 font-bold">Tank Status</div>
|
||||
<div class="col-span-12 py-2 px-2 text-red-600" v-if="customer_tank.tank_status == false">
|
||||
Needs Inspection / Bad Tank
|
||||
</div>
|
||||
<div class="col-span-12 py-2 px-2" v-else>
|
||||
Inspected
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-span-6 ">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-12 font-bold flex text-2xl">
|
||||
<router-link :to="{ name: 'TankEdit', params: { id: customer.id } }"
|
||||
class="btn-sm btn btn-secondary">
|
||||
Edit Tank
|
||||
</router-link>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-span-12 py-2 font-bold">Fill Location</div>
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
{{ customer_description.fill_location }}
|
||||
</div>
|
||||
<div class="col-span-12 py-2 font-bold">Tank Size</div>
|
||||
<div class="col-span-12 py-2 px-2">
|
||||
{{ customer_tank.tank_size }}
|
||||
</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>
|
||||
|
||||
<div class="col-span-12 p-5">
|
||||
@@ -162,7 +231,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 CreditCard</button>
|
||||
<button class="btn btn-sm btn-secondary text-white">Add Credit Card</button>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-span-12 font-bold flex">
|
||||
@@ -177,7 +246,7 @@
|
||||
|
||||
<div class="flex flex-row ">
|
||||
<div v-if="card.main_card" class="basis-1/3 p-2">
|
||||
<div class="bg-accent rounded-md border-2 ">
|
||||
<div class="bg-neutral rounded-md border-2 ">
|
||||
<div class="flex p-3">
|
||||
{{ card.type_of_card }}
|
||||
</div>
|
||||
@@ -185,7 +254,7 @@
|
||||
{{ card.name_on_card }}
|
||||
</div>
|
||||
<div class="flex p-1 pl-4">
|
||||
{{ card.card_number }}
|
||||
{{ card.card_number }}
|
||||
</div>
|
||||
<div class="flex p-1 pl-4">
|
||||
{{ card.expiration_month }}/ {{ card.expiration_year }}
|
||||
@@ -235,7 +304,9 @@
|
||||
</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>
|
||||
<!-- <div class="col-span-12 p-5">
|
||||
<div class="grid grid-cols-12">
|
||||
<div class="col-span-6 font-bold flex text-2xl">
|
||||
@@ -261,9 +332,7 @@
|
||||
<th>Address</th>
|
||||
<th>Gallons</th>
|
||||
<th>Date</th>
|
||||
<th>Automatic</th>
|
||||
<th>Prime</th>
|
||||
<th>Same Day</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -285,42 +354,33 @@
|
||||
<td>{{ oil['customer_name'] }}</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>
|
||||
|
||||
{{ oil['gallons_delivered'] }}
|
||||
</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 btn-sm">View</button>
|
||||
</router-link>
|
||||
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
|
||||
<button class="btn btn-accent btn-sm">Print</button>
|
||||
<button class="btn btn-secondary btn-sm">View</button>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
|
||||
<button class="btn btn-sm btn-accent">Edit</button>
|
||||
<button class="btn btn-sm btn-secondary">Edit</button>
|
||||
</router-link>
|
||||
|
||||
<router-link :to="{ name: 'finalizeTicket', params: { id: oil['id'] } }" v-if="oil['delivery_status'] != 10">
|
||||
<button class="btn btn-sm btn-success">Finalize</button>
|
||||
|
||||
<router-link :to="{ name: 'Ticket', params: { id: oil['id'] } }">
|
||||
<button class="btn btn-secondary btn-sm">Print Ticket</button>
|
||||
</router-link>
|
||||
<!--
|
||||
|
||||
<router-link :to="{ name: 'finalizeTicket', params: { id: oil['id'] } }"
|
||||
v-if="oil['delivery_status'] != 10">
|
||||
<button class="btn btn-secondary btn-sm">Finalize</button>
|
||||
</router-link>
|
||||
<!--
|
||||
<a @click.prevent="deleteCall(oil['id'])">
|
||||
<button class="btn btn-sm btn-error">Delete</button>
|
||||
</a> -->
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -399,6 +459,13 @@ export default defineComponent({
|
||||
fill_location: 0,
|
||||
description: '',
|
||||
},
|
||||
customer_tank: {
|
||||
id: 0,
|
||||
last_tank_inspection: null,
|
||||
tank_status: false,
|
||||
outside_or_inside: false,
|
||||
tank_size: 0,
|
||||
},
|
||||
customer_stats: {
|
||||
id: 0,
|
||||
customer_id: 0,
|
||||
@@ -462,7 +529,7 @@ export default defineComponent({
|
||||
this.user = null
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
userAutomaticStatus(userid: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/customer/automatic/status/' + userid;
|
||||
axios({
|
||||
@@ -471,7 +538,7 @@ export default defineComponent({
|
||||
headers: authHeader(),
|
||||
}).then((response: any) => {
|
||||
this.automatic_status = response.data.status
|
||||
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
@@ -510,7 +577,7 @@ export default defineComponent({
|
||||
type: 'Warning' // Adjust type if needed
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.getCustomer(this.$route.params.id);
|
||||
this.getCreditCards(this.$route.params.id)
|
||||
this.getCreditCardsCount(this.$route.params.id)
|
||||
@@ -526,6 +593,7 @@ export default defineComponent({
|
||||
}).then((response: any) => {
|
||||
|
||||
this.customer = response.data
|
||||
this.getCustomerTank(this.customer.id)
|
||||
this.userAutomaticStatus(this.customer.id);
|
||||
this.getCustomerDescription(this.customer.id);
|
||||
this.getCustomerStats(this.customer.id);
|
||||
@@ -539,9 +607,8 @@ export default defineComponent({
|
||||
url: path,
|
||||
headers: authHeader(),
|
||||
}).then((response: any) => {
|
||||
|
||||
|
||||
this.customer_last_delivery = response.data.date
|
||||
console.log(response.data)
|
||||
})
|
||||
},
|
||||
getCustomerStats(userid: any) {
|
||||
@@ -566,7 +633,16 @@ export default defineComponent({
|
||||
this.customer_description = response.data
|
||||
})
|
||||
},
|
||||
|
||||
getCustomerTank(userid: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/customer/tank/' + userid;
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
headers: authHeader(),
|
||||
}).then((response: any) => {
|
||||
this.customer_tank = response.data
|
||||
})
|
||||
},
|
||||
|
||||
getCreditCards(user_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/payment/cards/' + user_id;
|
||||
@@ -634,14 +710,14 @@ export default defineComponent({
|
||||
if (response.data.ok) {
|
||||
notify({
|
||||
title: "Success",
|
||||
text: "deleted oil order",
|
||||
text: "deleted delivery",
|
||||
type: "success",
|
||||
});
|
||||
this.getPage(1)
|
||||
} else {
|
||||
notify({
|
||||
title: "Failure",
|
||||
text: "error deleting oil order",
|
||||
text: "error deleting delivery",
|
||||
type: "success",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import CustomerHome from '../customer/home.vue';
|
||||
import CustomerCreate from '../customer/create.vue';
|
||||
import CustomerEdit from "../customer/edit.vue";
|
||||
import CustomerProfile from "./profile/home.vue"
|
||||
import TankEdit from "./tank/edit.vue"
|
||||
|
||||
|
||||
const customerRoutes = [
|
||||
{
|
||||
@@ -22,11 +24,16 @@ const customerRoutes = [
|
||||
name: 'customerEdit',
|
||||
component: CustomerEdit,
|
||||
},
|
||||
{
|
||||
{
|
||||
path: '/customer/:id',
|
||||
name: 'customerProfile',
|
||||
component: CustomerProfile,
|
||||
},
|
||||
{
|
||||
path: '/tank/edit/:id',
|
||||
name: 'TankEdit',
|
||||
component: TankEdit,
|
||||
},
|
||||
]
|
||||
|
||||
export default customerRoutes
|
||||
|
||||
283
src/pages/customer/tank/edit.vue
Normal file
283
src/pages/customer/tank/edit.vue
Normal file
@@ -0,0 +1,283 @@
|
||||
<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]">
|
||||
Customer: {{ customer.customer_first_name }} {{ customer.customer_last_name }} | {{ customer.account_number }}
|
||||
</div>
|
||||
|
||||
<form class="rounded-md px-8 pt-6 pb-8 mb-4 w-full" enctype="multipart/form-data"
|
||||
@submit.prevent="onSubmit">
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-white text-sm font-bold mb-2">Inspection Date </label>
|
||||
<input v-model="CreateTankForm.basicInfo.last_tank_inspection"
|
||||
class="input input-bordered input-sm w-full max-w-xs" id="title" type="date"
|
||||
min="2023-01-01" max="2030-01-01" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-white text-sm font-bold mb-2">Good Or bad Tank</label>
|
||||
<label>
|
||||
<input type="radio" name="goodtank1" value="true" class="radio"
|
||||
v-model="CreateTankForm.basicInfo.tank_status" />
|
||||
Good
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="goodtank2" value="false" class="radio"
|
||||
v-model="CreateTankForm.basicInfo.tank_status" />
|
||||
Bad
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-white text-sm font-bold mb-2">Tank Size</label>
|
||||
<input v-model="CreateTankForm.basicInfo.tank_size"
|
||||
class="input input-bordered input-sm w-full max-w-xs" id="title" type="text"
|
||||
placeholder="Gallon size of tank" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-white text-sm font-bold mb-2">Inside or Outside</label>
|
||||
<label>
|
||||
<input type="radio" name="insideoutside1" value="true" class="radio"
|
||||
v-model="CreateTankForm.basicInfo.outside_or_inside" />
|
||||
Inside
|
||||
</label>
|
||||
<label>
|
||||
|
||||
<input type="radio" name="insideoutside2" value="false" class="radio"
|
||||
v-model="CreateTankForm.basicInfo.outside_or_inside" />
|
||||
Outside
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-white text-sm font-bold mb-2">Fill Location</label>
|
||||
<input v-model="CreateTankForm.basicInfo.fill_location"
|
||||
class="input input-bordered input-sm w-full max-w-xs" id="title" type="text"
|
||||
placeholder="Fill Location" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
|
||||
<button class="btn btn-accent btn-sm">
|
||||
Edit Customer Tank
|
||||
</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'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'TankEdit',
|
||||
|
||||
components: {
|
||||
Header,
|
||||
SideBar,
|
||||
Footer,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
user: {
|
||||
id: '',
|
||||
},
|
||||
customer: {
|
||||
id: 0,
|
||||
user_id: 0,
|
||||
customer_first_name: '',
|
||||
customer_last_name: '',
|
||||
customer_town: '',
|
||||
customer_address: '',
|
||||
customer_state: 0,
|
||||
customer_zip: '',
|
||||
customer_apt: '',
|
||||
customer_home_type: 0,
|
||||
customer_phone_number: '',
|
||||
account_number: '',
|
||||
},
|
||||
tank: {
|
||||
customer_id: 0,
|
||||
last_tank_inspection: true,
|
||||
tank_status: true,
|
||||
outside_or_inside: true,
|
||||
tank_size: 0,
|
||||
|
||||
},
|
||||
|
||||
CreateTankForm: {
|
||||
basicInfo: {
|
||||
last_tank_inspection: null,
|
||||
tank_status: true,
|
||||
outside_or_inside: true,
|
||||
tank_size: 0,
|
||||
fill_location: 0,
|
||||
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.userStatus()
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.getCustomer(this.$route.params.id);
|
||||
this.getCustomerDescription(this.$route.params.id);
|
||||
this.getTank(this.$route.params.id);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getCustomer(this.$route.params.id);
|
||||
this.getCustomerDescription(this.$route.params.id);
|
||||
this.getTank(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;
|
||||
this.user.id = response.data.user.id;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.user.id = '';
|
||||
})
|
||||
},
|
||||
getCustomer(userid: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
headers: authHeader(),
|
||||
}).then((response: any) => {
|
||||
this.customer = response.data
|
||||
})
|
||||
},
|
||||
getCustomerDescription(userid: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/customer/description/' + userid;
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
headers: authHeader(),
|
||||
}).then((response: any) => {
|
||||
|
||||
this.CreateTankForm.basicInfo.fill_location = response.data.fill_location;
|
||||
})
|
||||
},
|
||||
getTank(customer_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/customer/tank/" + customer_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.tank = response.data
|
||||
|
||||
this.CreateTankForm.basicInfo.last_tank_inspection = response.data.last_tank_inspection;
|
||||
this.CreateTankForm.basicInfo.tank_status = response.data.tank_status;
|
||||
this.CreateTankForm.basicInfo.outside_or_inside = response.data.outside_or_inside;
|
||||
this.CreateTankForm.basicInfo.tank_size = response.data.tank_size;
|
||||
|
||||
console.log(this.CreateTankForm.basicInfo.outside_or_inside)
|
||||
console.log(this.CreateTankForm.basicInfo.tank_status)
|
||||
})
|
||||
},
|
||||
editTank(payload: {
|
||||
|
||||
last_tank_inspection: any;
|
||||
tank_status: boolean;
|
||||
outside_or_inside: boolean;
|
||||
tank_size: number;
|
||||
fill_location: number;
|
||||
}) {
|
||||
|
||||
let path = import.meta.env.VITE_BASE_URL + "/customer/edit/tank/" + this.$route.params.id;
|
||||
axios({
|
||||
method: "put",
|
||||
url: path,
|
||||
data: payload,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.$router.push({ name: "customerProfile", params: { id: this.tank.customer_id } });
|
||||
}
|
||||
if (response.data.error) {
|
||||
this.$router.push("/");
|
||||
}
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
console.log(this.CreateTankForm.basicInfo.outside_or_inside)
|
||||
console.log(this.CreateTankForm.basicInfo.tank_status)
|
||||
let payload = {
|
||||
last_tank_inspection: this.CreateTankForm.basicInfo.last_tank_inspection,
|
||||
tank_status: this.CreateTankForm.basicInfo.tank_status,
|
||||
outside_or_inside: this.CreateTankForm.basicInfo.outside_or_inside,
|
||||
tank_size: this.CreateTankForm.basicInfo.tank_size,
|
||||
fill_location: this.CreateTankForm.basicInfo.fill_location,
|
||||
};
|
||||
this.editTank(payload);
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user