Updated autos

This commit is contained in:
2024-07-02 16:53:33 -04:00
parent 4def44d82e
commit 72b19034ad
7 changed files with 345 additions and 76 deletions

View File

@@ -19,7 +19,7 @@
</router-link>
</li>
</ul>
<div class="w-full mt-10" >
<div class="w-full mt-10">
<div class="grid grid-cols-12 gap-5">
<div class="col-span-4 p-5 ">
@@ -34,26 +34,36 @@
Create Delivery
</router-link>
<router-link :to="{ name: 'customerEdit', params: { id: customer.id } }"
class="btn-sm btn btn-accent">
Edit Customer
</router-link>
<div v-if="automatic_status === 0">
<button :innerText="buttonText" v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
</button>
</div>
<div class="col-span-12 font-bold flex pb-5 text-lg">{{ customer.account_number }}</div>
<div v-else>
<button :innerText="buttonText" v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
</button>
</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" :innerText="autoText" v-else>Will Call</div>
<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 v-if="customer.customer_apt != 'None'">
{{ customer.customer_apt }}
</div>
</div>
<div class="col-span-12 font-bold flex">
<div class="pr-2">
{{ customer.customer_town }},
@@ -255,7 +265,7 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-sm btn-accent">Edit</button>
</router-link>
</router-link>
<a @click.prevent="deleteCall(oil['id'])">
<button class="btn btn-sm btn-error">Delete</button>
</a>
@@ -296,6 +306,9 @@ export default defineComponent({
return {
token: null,
user: null,
isTrue: true,
automatic_status: 0,
automatic_response: 0,
credit_cards: [
{
id: 0,
@@ -333,7 +346,7 @@ export default defineComponent({
delivery_format: false,
delivery_template: PaginationComp
},
}
},
created() {
@@ -344,11 +357,15 @@ export default defineComponent({
},
mounted() {
this.getPage(this.delivery_page)
},
computed: {
buttonText() {
return this.isTrue ? 'Become Automatic Customer' : 'Become Willcall Customer';
},
autoText() {
return this.isTrue? 'Will Call' : 'Automatic ';
}
},
watch: {
$route() {
this.getCustomer(this.$route.params.id);
@@ -376,6 +393,45 @@ export default defineComponent({
this.user = null
})
},
userAutomaticStatus(userid: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/automatic/status/' + userid;
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.automatic_status = response.data.status
console.log(this.automatic_status)
})
},
userAutomatic(userid: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/automatic/assign/' + userid;
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.isTrue = !this.isTrue;
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',
type: 'Success'
})
}
})
},
getCustomer(userid: any) {
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
@@ -386,6 +442,7 @@ export default defineComponent({
}).then((response: any) => {
this.customer = response.data
this.userAutomaticStatus(this.customer.id);
})
},