added print button and finalize

This commit is contained in:
2024-03-29 19:57:34 -04:00
parent 5b13032cd6
commit 2d9fce2e89
21 changed files with 1040 additions and 684 deletions

View File

@@ -1,34 +1,36 @@
<template>
<Header/>
<Header />
<div class="flex">
<div class="">
<SideBar/>
<SideBar />
</div>
<div class=" w-full px-10 ">
<div class="text-sm breadcrumbs">
<div class="text-sm breadcrumbs pb-10">
<ul>
<li>
<router-link :to="{ name: 'home' }">
Home
</router-link>
</li>
</ul>
</div>
<div class="flex justify-end">
<div class="flex start pb-10">Waiting Deliveries </div>
<div class="flex justify-start pb-5">
<button @click.prevent="printtTicketAll" class="btn btn-accent">
Print All
</button>
</div>
<div class="overflow-x-auto">
<div class="flex start">Waiting Deliveries</div>
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Ticket Id</th>
<th>Name</th>
<th>Status</th>
<th>Town</th>
<th>Address</th>
<th>Gallons</th>
<th>Date</th>
@@ -39,8 +41,10 @@
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']"> <router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }} </td>
<router-link :to="{ name: 'customerProfile', params: { id: oil['customer_id'] } }">
<td>{{ oil['customer_name'] }} </td>
</router-link>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
@@ -75,12 +79,13 @@
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryOrder', params: { id: oil['id'] } }">
<button class="btn">View</button>
<button class="btn btn-accent">View</button>
</router-link>
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn">Edit</button>
<button class="btn btn-accent">Edit</button>
</router-link>
<button @click.prevent="deleteCall(oil['id'])" class="btn">Delete</button>
<button @click.prevent="deleteCall(oil['id'])" class="btn btn-accent">Delete</button>
<button @click.prevent="printTicket(oil['id'])" class="btn btn-accent">Print</button>
</td>
</tr>
</tbody>
@@ -195,6 +200,53 @@ export default defineComponent({
}
})
},
printtTicketAll() {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/all/print_waiting';
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Sent to Printer",
type: "success",
});
this.getPage(this.page)
} else {
notify({
title: "Failure",
text: "error printing",
type: "success",
});
}
})
},
printTicket(delivery_id: number) {
let path = import.meta.env.VITE_PRINT_URL + '/command/printticket/' + delivery_id;
axios({
method: 'delete',
url: path,
headers: authHeader(),
}).then((response: any) => {
if (response.data.ok) {
notify({
title: "Success",
text: "Sent to Printer",
type: "success",
});
this.getPage(this.page)
} else {
notify({
title: "Failure",
text: "error printing",
type: "success",
});
}
})
},
},
})
</script>