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

@@ -62,14 +62,17 @@
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']">
<td>
<input type="checkbox" :value="oil['id']" v-model="checkedMaterials">
</td>
<td>{{ oil['estimated_gallons_left'] }}</td>
<td>
<div v-if="oil['auto_status'] === 0"></div>
<div v-else-if="oil['auto_status'] === 1">Waiting on Delivery</div>
<div v-if="oil['auto_status'] === 0">
</div>
<div v-else-if="oil['auto_status'] === 1">Waiting on Delivery </div>
<div v-else-if="oil['auto_status'] === 2">Pending Payment Confirmation </div>
<div v-else></div>
</td>
<td>{{ oil['customer_full_name'] }}</td>
@@ -91,6 +94,7 @@
</router-link>
</td>
</tr>
</tbody>
</table>
</div>
@@ -108,6 +112,8 @@ 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'
import { notify } from "@kyvg/vue3-notification";
export default defineComponent({
name: 'AutomaticHome',
@@ -138,6 +144,7 @@ export default defineComponent({
created() {
this.userStatus()
this.getDriversList()
this.get_oil_orders()
},
mounted() {
this.get_oil_orders()
@@ -163,6 +170,7 @@ export default defineComponent({
},
get_oil_orders() {
let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers';
axios({
method: 'get',
@@ -170,6 +178,7 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
}).then((response: any) => {
console.log("here")
this.deliveries = response.data
})
@@ -193,8 +202,7 @@ export default defineComponent({
get_auto_assignment() {
let path = import.meta.env.VITE_AUTO_URL + '/delivery/create/delivery';
let path = import.meta.env.VITE_AUTO_URL + '/delivery/create';
const selectedValues : any[] = [];
for (const id in this.checkedMaterials) {
@@ -213,6 +221,23 @@ export default defineComponent({
withCredentials: true,
headers: authHeader(),
}).then((response: any) => {
console.log(response.data.count)
if (response.data.count > 0) {
notify({
title: "Success",
text: "Added automatics to delivery",
type: "success",
});
} else {
notify({
title: "Failure",
text: "Incorrect driver or no auto selection.",
type: "error",
});
}
this.get_oil_orders()
})
},