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="mb-10">
<div class="">Home Factor</div>
<div class="pl-10"> 1.00 = medium</div>
<div class="pl-10">1.50 = large</div>
<div class="pl-10">0.50 = small</div>
<div class="pl-10">1.50 = large oil usage</div>
<div class="pl-10"> 1.00 = medium oil usage</div>
<div class="pl-10">0.50 = small oil usage</div>
</div>
<div class="overflow-x-auto bg-neutral">
@@ -32,25 +32,28 @@
<!-- head -->
<thead>
<tr>
<th>Gallons Left</th>
<th>Home Factor</th>
<th>Town</th>
<th>Estimated Gallons Left</th>
<th>Name</th>
<th>Town</th>
<th>Address</th>
<th>Last Fill</th>
<th>Home Factor</th>
</tr>
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']">
<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_town'] }}</td>
<td>{{ oil['customer_address'] }}</td>
<td>{{ oil['last_fill'] }} </td>
<td>{{ oil['house_factor'] }}</td>
<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">
Edit
</button>
@@ -127,17 +130,14 @@ export default defineComponent({
get_oil_orders() {
let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers';
console.log(path)
console.log("woop")
axios({
method: 'get',
url: path,
withCredentials: true,
headers: authHeader(),
}).then((response: any) => {
this.deliveries = response.data.automatics
console.log("here")
console.log(this.deliveries)
this.deliveries = response.data
})
},
},

View File

@@ -132,13 +132,17 @@
</span>
</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>
<input v-model="CreateCustomerForm.basicInfo.customer_automatic" class="checkbox checkbox-xs" id="automatic"
type="checkbox" />
<input v-model="CreateCustomerForm.basicInfo.customer_automatic" class="checkbox" type="checkbox" />
</div>
<div class="col-span-12 md:col-span-12 flex mt-5 mb-5">
<button class="btn">
<button class="btn btn-primary">
Edit Customer
</button>
</div>
@@ -197,7 +201,7 @@ export default defineComponent({
customer_apt: "",
customer_home_type: "",
customer_zip: "",
customer_automatic: "",
customer_automatic: false,
customer_email: "",
customer_phone_number: "",
customer_state: "",
@@ -276,12 +280,22 @@ export default defineComponent({
this.CreateCustomerForm.basicInfo.customer_town = response.data.customer_town;
this.CreateCustomerForm.basicInfo.customer_state = response.data.customer_state;
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_home_type = response.data.customer_home_type;
this.CreateCustomerForm.basicInfo.customer_apt = response.data.customer_apt;
this.CreateCustomerForm.basicInfo.customer_email = response.data.customer_email;
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_email: string;
customer_phone_number: string;
customer_automatic: string;
customer_automatic: boolean;
customer_home_type: string,
customer_state: string;
customer_address: string;

View File

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

View File

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