This commit is contained in:
2024-05-16 14:36:52 -04:00
parent 7164e41aa1
commit 52a02c7595
34 changed files with 771 additions and 2342 deletions

View File

@@ -19,7 +19,7 @@
</router-link>
</li>
</ul>
<div class="w-full mt-10" v-if="customer !== null">
<div class="w-full mt-10" >
<div class="grid grid-cols-12 gap-5">
<div class="col-span-4 p-5 ">
@@ -215,6 +215,7 @@
<th>Automatic</th>
<th>Prime</th>
<th>Same Day</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -254,16 +255,16 @@
<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>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -332,16 +333,19 @@ export default defineComponent({
delivery_format: false,
delivery_template: PaginationComp
},
}
},
created() {
this.userStatus()
this.getCustomer(this.$route.params.id);
this.getCreditCards(this.$route.params.id)
this.getCreditCardsCount(this.$route.params.id)
},
mounted() {
this.getCustomer(this.$route.params.id)
this.getCustomerDelivery(this.$route.params.id, this.delivery_page)
this.getPage(this.delivery_page)
},
@@ -353,7 +357,7 @@ export default defineComponent({
methods: {
getPage: function (page: any) {
// we simulate an api call that fetch the records from a backend
this.getCustomer(page)
this.getCustomerDelivery(this.$route.params.id, page)
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
@@ -441,6 +445,29 @@ export default defineComponent({
})
},
deleteCall(delivery_id: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "deleted oil order",
type: "success",
});
this.getPage
} else {
notify({
title: "Failure",
text: "error deleting oil order",
type: "success",
});
}
})
},
},
})
</script>