Fixed button automatic

This commit is contained in:
2024-07-29 13:46:53 -04:00
parent 47e57f5758
commit 2c6077e0fa
3 changed files with 60 additions and 27 deletions

View File

@@ -40,18 +40,20 @@
</router-link>
<div v-if="automatic_status === 0">
<button :innerText="buttonText" v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
<button v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
Become Automatic Customer
</button>
</div>
<div v-else>
<button :innerText="buttonText" v-on:click="userAutomatic(customer.id)" class="btn btn-accent btn-sm">
<button v-on:click="userAutomatic(customer.id)" class="btn btn-accent 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" :innerText="autoText">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" :innerText="autoText" 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 }}
@@ -359,12 +361,7 @@ export default defineComponent({
this.getPage(this.delivery_page)
},
computed: {
buttonText() {
return this.isTrue ? 'Become WillCall Customer' : 'Become Automatic Customer';
},
autoText() {
return this.isTrue? 'Automatic' : 'Will Call';
}
},
watch: {
$route() {
@@ -402,7 +399,6 @@ export default defineComponent({
headers: authHeader(),
}).then((response: any) => {
this.automatic_status = response.data.status
console.log(this.automatic_status)
})
},
@@ -415,24 +411,37 @@ export default defineComponent({
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 {
});
} else if (this.automatic_response == 2) {
this.$notify({
title: "Automatic Status",
text: 'Customer is now will call',
type: 'Success'
})
text: 'Customer does not have a main credit card. Can not make automatic.',
type: 'Error'
});
} else if (this.automatic_response == 3) {
this.$notify({
title: "Automatic Status",
text: 'Customer is now a Call in ',
type: 'Info' // Adjust type if needed
});
} else {
this.$notify({
title: "Automatic Status",
text: 'Customer is now Manual Customer',
type: 'Warning' // Adjust type if needed
});
}
this.getCustomer(this.$route.params.id);
this.getCreditCards(this.$route.params.id)
this.getCreditCardsCount(this.$route.params.id)
})
},