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,79 +19,64 @@
</li>
</ul>
</div>
<div class="flex start text-2xl">Automatics </div>
<div class="flex start text-2xl mb-10">Automatics </div>
<div class="mb-10">
<div class="">Home Factor</div>
<div class="pl-10"> 1.00 = medium</div>
<div class="pl-10">1.50 = large</div>
<div class="pl-10">0.50 = small</div>
</div>
<div class="overflow-x-auto bg-neutral">
<table class="table">
<!-- head -->
<thead>
<tr>
<th>Ticket ID</th>
<th>Due Date</th>
<th>Status</th>
<th>Gallons Left</th>
<th>Home Factor</th>
<th>Town</th>
<th>Name</th>
<th>Address</th>
<th>Gallons</th>
<th>Date</th>
<th>Last Fill</th>
</tr>
</thead>
<tbody>
<!-- row 1 -->
<tr v-for="oil in deliveries" :key="oil['id']">
<td>{{ oil['id'] }}</td>
<td>
<div v-if="oil['delivery_status'] == 0">Waiting</div>
<div v-else-if="oil['delivery_status'] == 1">delivered</div>
<div v-else-if="oil['delivery_status'] == 2">Out for Delivery</div>
<div v-else-if="oil['delivery_status'] == 3">Cancelled</div>
<div v-else-if="oil['delivery_status'] == 4">Partial Delivery</div>
<div v-else-if="oil['delivery_status'] == 5">Issue</div>
<div v-else-if="oil['delivery_status'] == 10">Finalized</div>
<div v-else></div>
</td>
<td>{{ oil['estimated_gallons_left'] }}</td>
<td>{{ oil['house_factor'] }}</td>
<td>{{ oil['customer_town'] }}</td>
<td>{{ oil['customer_name'] }}</td>
<td>{{ oil['customer_full_name'] }}</td>
<td>{{ oil['customer_address'] }}</td>
<td>
<div v-if="oil['customer_asked_for_fill'] == 1">Fill</div>
<div v-else> {{ oil['gallons_ordered'] }}</div>
</td>
<td>
{{ oil['expected_delivery_date'] }}
</td>
<td>
<div v-if="oil['automatic'] == 0">No</div>
<div v-else>Yes</div>
</td>
<td>{{ oil['last_fill'] }} </td>
<td class="flex gap-5">
<router-link :to="{ name: 'deliveryEdit', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">Edit</button>
<button class="btn btn-accent btn-sm">
Edit
</button>
</router-link>
<router-link :to="{ name: 'TicketAuto', params: { id: oil['id'] } }">
<button class="btn btn-accent btn-sm">
Print
</button>
</router-link>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex justify-center" v-if="recordsLength > 9">
<pagination @paginate="getPage" :records="recordsLength" v-model="page" :per-page="perPage"
:options="options">
</pagination>
<div class="flex justify-center mb-10"> {{ recordsLength }} items Found</div>
</div>
</div>
</div>
<Footer/>
</template>
<script lang="ts">
import {defineComponent} from 'vue'
import axios from 'axios'
import authHeader from '../../services/auth.header'
import Header from '../../layouts/headers/headerauth.vue'
import PaginationComp from '../../components/pagination.vue'
import SideBar from '../../layouts/sidebar/sidebar.vue'
import Footer from '../../layouts/footers/footer.vue'
@@ -109,14 +94,7 @@ export default defineComponent({
token: null,
user: null,
deliveries: [],
page: 1,
perPage: 50,
recordsLength: 0,
options: {
edgeNavigation: false,
format: false,
template: PaginationComp
}
}
},
@@ -124,15 +102,11 @@ export default defineComponent({
this.userStatus()
},
mounted() {
this.getPage(this.page)
this.get_oil_orders()
},
methods: {
getPage: function (page: any) {
// we simulate an api call that fetch the records from a backend
this.deliveries = [];
this.get_oil_orders(page)
},
userStatus() {
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
axios({
@@ -150,14 +124,20 @@ export default defineComponent({
this.user = null
})
},
get_oil_orders(page: any) {
let path = import.meta.env.VITE_BASE_URL + '/delivery/all/' + page;
get_oil_orders() {
let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/customers';
console.log(path)
console.log("woop")
axios({
method: 'get',
url: path,
withCredentials: true,
headers: authHeader(),
}).then((response: any) => {
this.deliveries = response.data
this.deliveries = response.data.automatics
console.log("here")
console.log(this.deliveries)
})
},
},