auto kind of working

This commit is contained in:
2024-07-17 18:04:19 -04:00
parent 601c2e27ba
commit 74fcd282db
4 changed files with 49 additions and 32 deletions

View File

@@ -22,9 +22,9 @@
<div class="flex start text-2xl mb-10">Automatics </div> <div class="flex start text-2xl mb-10">Automatics </div>
<div class="mb-10"> <div class="mb-10">
<div class="">Home Factor</div> <div class="">Home Factor</div>
<div class="pl-10"> 1.00 = medium</div> <div class="pl-10">1.50 = large oil usage</div>
<div class="pl-10">1.50 = large</div> <div class="pl-10"> 1.00 = medium oil usage</div>
<div class="pl-10">0.50 = small</div> <div class="pl-10">0.50 = small oil usage</div>
</div> </div>
<div class="overflow-x-auto bg-neutral"> <div class="overflow-x-auto bg-neutral">
@@ -32,25 +32,28 @@
<!-- head --> <!-- head -->
<thead> <thead>
<tr> <tr>
<th>Gallons Left</th> <th>Estimated Gallons Left</th>
<th>Home Factor</th>
<th>Town</th>
<th>Name</th> <th>Name</th>
<th>Town</th>
<th>Address</th> <th>Address</th>
<th>Last Fill</th> <th>Last Fill</th>
<th>Home Factor</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<!-- row 1 --> <!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['estimated_gallons_left'] }}</td> <td>{{ oil['estimated_gallons_left'] }}</td>
<td>{{ oil['house_factor'] }}</td>
<td>{{ oil['customer_town'] }}</td>
<td>{{ oil['customer_full_name'] }}</td> <td>{{ oil['customer_full_name'] }}</td>
<td>{{ oil['customer_town'] }}</td>
<td>{{ oil['customer_address'] }}</td> <td>{{ oil['customer_address'] }}</td>
<td>{{ oil['last_fill'] }} </td> <td>{{ oil['last_fill'] }} </td>
<td>{{ oil['house_factor'] }}</td>
<td class="flex gap-5"> <td class="flex gap-5">
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }"> <router-link :to="{ name: 'customerEdit', params: { id: oil['customer_id'] } }">
<button class="btn btn-accent btn-sm"> <button class="btn btn-accent btn-sm">
Edit Edit
</button> </button>
@@ -127,17 +130,14 @@ export default defineComponent({
get_oil_orders() { get_oil_orders() {
let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers'; let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers';
console.log(path)
console.log("woop")
axios({ axios({
method: 'get', method: 'get',
url: path, url: path,
withCredentials: true, withCredentials: true,
headers: authHeader(), headers: authHeader(),
}).then((response: any) => { }).then((response: any) => {
this.deliveries = response.data.automatics this.deliveries = response.data
console.log("here")
console.log(this.deliveries)
}) })
}, },
}, },

View File

@@ -132,13 +132,17 @@
</span> </span>
</div> </div>
<div class="col-span-12 md:col-span-4 mb-5 md:mb-0">
<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> <label class="block text-white text-sm font-bold mb-2">Automatic</label>
<input v-model="CreateCustomerForm.basicInfo.customer_automatic" class="checkbox checkbox-xs" id="automatic" <input v-model="CreateCustomerForm.basicInfo.customer_automatic" class="checkbox" type="checkbox" />
type="checkbox" />
</div> </div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5"> <div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn"> <button class="btn btn-primary">
Edit Customer Edit Customer
</button> </button>
</div> </div>
@@ -197,7 +201,7 @@ export default defineComponent({
customer_apt: "", customer_apt: "",
customer_home_type: "", customer_home_type: "",
customer_zip: "", customer_zip: "",
customer_automatic: "", customer_automatic: false,
customer_email: "", customer_email: "",
customer_phone_number: "", customer_phone_number: "",
customer_state: "", customer_state: "",
@@ -276,12 +280,22 @@ export default defineComponent({
this.CreateCustomerForm.basicInfo.customer_town = response.data.customer_town; this.CreateCustomerForm.basicInfo.customer_town = response.data.customer_town;
this.CreateCustomerForm.basicInfo.customer_state = response.data.customer_state; this.CreateCustomerForm.basicInfo.customer_state = response.data.customer_state;
this.CreateCustomerForm.basicInfo.customer_zip = response.data.customer_zip; this.CreateCustomerForm.basicInfo.customer_zip = response.data.customer_zip;
this.CreateCustomerForm.basicInfo.customer_automatic = response.data.customer_automatic;
this.CreateCustomerForm.basicInfo.customer_phone_number = response.data.customer_phone_number; this.CreateCustomerForm.basicInfo.customer_phone_number = response.data.customer_phone_number;
this.CreateCustomerForm.basicInfo.customer_home_type = response.data.customer_home_type; this.CreateCustomerForm.basicInfo.customer_home_type = response.data.customer_home_type;
this.CreateCustomerForm.basicInfo.customer_apt = response.data.customer_apt; this.CreateCustomerForm.basicInfo.customer_apt = response.data.customer_apt;
this.CreateCustomerForm.basicInfo.customer_email = response.data.customer_email; this.CreateCustomerForm.basicInfo.customer_email = response.data.customer_email;
this.CreateCustomerForm.basicInfo.customer_address = response.data.customer_address; this.CreateCustomerForm.basicInfo.customer_address = response.data.customer_address;
if (response.data.customer_automatic === 1){
this.CreateCustomerForm.basicInfo.customer_automatic = true
console.log("poop")
}
if (response.data.customer_automatic === 0){
this.CreateCustomerForm.basicInfo.customer_automatic = false
console.log("butt")
}
} }
}) })
}, },
@@ -292,7 +306,7 @@ export default defineComponent({
customer_zip: string; customer_zip: string;
customer_email: string; customer_email: string;
customer_phone_number: string; customer_phone_number: string;
customer_automatic: string; customer_automatic: boolean;
customer_home_type: string, customer_home_type: string,
customer_state: string; customer_state: string;
customer_address: string; customer_address: string;

View File

@@ -360,10 +360,10 @@ export default defineComponent({
}, },
computed: { computed: {
buttonText() { buttonText() {
return this.isTrue ? 'Become Automatic Customer' : 'Become Willcall Customer'; return this.isTrue ? 'Become WillCall Customer' : 'Become Automatic Customer';
}, },
autoText() { autoText() {
return this.isTrue? 'Will Call' : 'Automatic '; return this.isTrue? 'Automatic' : 'Will Call';
} }
}, },
watch: { watch: {
@@ -403,6 +403,7 @@ export default defineComponent({
}).then((response: any) => { }).then((response: any) => {
this.automatic_status = response.data.status this.automatic_status = response.data.status
console.log(this.automatic_status) console.log(this.automatic_status)
}) })
}, },
@@ -418,12 +419,14 @@ export default defineComponent({
this.automatic_response = response.data.status this.automatic_response = response.data.status
if (this.automatic_response == 1) { if (this.automatic_response == 1) {
this.$notify({ this.$notify({
title: "Automatic Status", title: "Automatic Status",
text: 'Customer is now Automatic Customer', text: 'Customer is now Automatic Customer',
type: 'Success' type: 'Success'
}) })
} else { } else {
this.$notify({ this.$notify({
title: "Automatic Status", title: "Automatic Status",
text: 'Customer is now will call', text: 'Customer is now will call',

View File

@@ -152,8 +152,8 @@ export default defineComponent({
withCredentials: true, withCredentials: true,
}) })
.then((response: any) => { .then((response: any) => {
this.automatic = response.data.automatic; this.automatic = response.data;
this.getCustomer(response.data.automatic.customer_id); this.getCustomer(response.data.customer_id);
this.sumdelivery(this.$route.params.id); this.sumdelivery(this.$route.params.id);
}) })