Updated auto
This commit is contained in:
@@ -25,6 +25,23 @@
|
|||||||
<div class="pl-10">1.50 = large oil usage</div>
|
<div class="pl-10">1.50 = large oil usage</div>
|
||||||
<div class="pl-10"> 1.00 = medium oil usage</div>
|
<div class="pl-10"> 1.00 = medium oil usage</div>
|
||||||
<div class="pl-10">0.50 = small oil usage</div>
|
<div class="pl-10">0.50 = small oil usage</div>
|
||||||
|
<form class="col-span-12 rounded-md px-8 pt-6 pb-8 mb-4 w-full" enctype="multipart/form-data"
|
||||||
|
@submit.prevent="get_auto_assignment">
|
||||||
|
|
||||||
|
<div class="flex-1 mb-4">
|
||||||
|
<label class="block text-white text-sm font-bold mb-2">Delivery Driver </label>
|
||||||
|
<select class="select select-bordered select-sm w-full max-w-xs" aria-label="Default select example"
|
||||||
|
id="customer_state" v-model="CreateOilOrderForm.basicInfo.driver_driver">
|
||||||
|
<option class="text-white" v-for="(driver, index) in truckDriversList" :key="index"
|
||||||
|
:value="driver['id']">
|
||||||
|
{{ driver['employee_first_name'] }} {{ driver['employee_last_name'] }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-accent btn-sm">
|
||||||
|
Send for delivery
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-x-auto bg-neutral">
|
<div class="overflow-x-auto bg-neutral">
|
||||||
|
|
||||||
@@ -32,8 +49,9 @@
|
|||||||
<!-- head -->
|
<!-- head -->
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Estimated Gallons Left</th>
|
<th></th>
|
||||||
|
<th>Gallons Left</th>
|
||||||
|
<th>Status</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Town</th>
|
<th>Town</th>
|
||||||
<th>Address</th>
|
<th>Address</th>
|
||||||
@@ -44,15 +62,23 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<!-- row 1 -->
|
<!-- row 1 -->
|
||||||
<tr v-for="oil in deliveries" :key="oil['id']">
|
<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>{{ 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-else></div>
|
||||||
|
</td>
|
||||||
<td>{{ oil['customer_full_name'] }}</td>
|
<td>{{ oil['customer_full_name'] }}</td>
|
||||||
<td>{{ oil['customer_town'] }}</td>
|
<td>{{ oil['customer_town'] }}</td>
|
||||||
<td>{{ oil['customer_address'] }}</td>
|
<td>{{ oil['customer_address'] }}</td>
|
||||||
<td>{{ oil['last_fill'] }} </td>
|
<td>{{ oil['last_fill'] }} </td>
|
||||||
<td>{{ oil['house_factor'] }}</td>
|
<td>{{ oil['house_factor'] }}</td>
|
||||||
<td class="flex gap-5">
|
<td class="flex gap-5">
|
||||||
|
|
||||||
<router-link :to="{ name: 'customerEdit', params: { id: oil['customer_id'] } }">
|
<router-link :to="{ name: 'customerEdit', params: { id: oil['customer_id'] } }">
|
||||||
<button class="btn btn-accent btn-sm">
|
<button class="btn btn-accent btn-sm">
|
||||||
Edit
|
Edit
|
||||||
@@ -97,19 +123,27 @@ export default defineComponent({
|
|||||||
token: null,
|
token: null,
|
||||||
user: null,
|
user: null,
|
||||||
deliveries: [],
|
deliveries: [],
|
||||||
|
checkedMaterials: [],
|
||||||
|
truckDriversList: [],
|
||||||
|
CreateOilOrderForm: {
|
||||||
|
basicInfo: {
|
||||||
|
|
||||||
|
driver_driver: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.userStatus()
|
this.userStatus()
|
||||||
|
this.getDriversList()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.get_oil_orders()
|
this.get_oil_orders()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
userStatus() {
|
userStatus() {
|
||||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||||
axios({
|
axios({
|
||||||
@@ -140,6 +174,50 @@ export default defineComponent({
|
|||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
getDriversList() {
|
||||||
|
let path = import.meta.env.VITE_BASE_URL + "/employee/drivers";
|
||||||
|
axios({
|
||||||
|
method: "get",
|
||||||
|
url: path,
|
||||||
|
withCredentials: true,
|
||||||
|
headers: authHeader(),
|
||||||
|
})
|
||||||
|
.then((response: any) => {
|
||||||
|
this.truckDriversList = response.data;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
get_auto_assignment() {
|
||||||
|
let path = import.meta.env.VITE_AUTO_URL + '/delivery/create/delivery';
|
||||||
|
|
||||||
|
|
||||||
|
const selectedValues : any[] = [];
|
||||||
|
for (const id in this.checkedMaterials) {
|
||||||
|
if (this.checkedMaterials[id]) {
|
||||||
|
selectedValues.push(this.checkedMaterials[id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let payload = {
|
||||||
|
driver_employee_id: this.CreateOilOrderForm.basicInfo.driver_driver,
|
||||||
|
values: selectedValues
|
||||||
|
}
|
||||||
|
axios({
|
||||||
|
method: 'post',
|
||||||
|
url: path,
|
||||||
|
data: payload,
|
||||||
|
withCredentials: true,
|
||||||
|
headers: authHeader(),
|
||||||
|
}).then((response: any) => {
|
||||||
|
this.get_oil_orders()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -632,8 +632,46 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
UpdateAuto(payload: {
|
||||||
|
gallons: string,
|
||||||
|
delivery_id: string,
|
||||||
|
}) {
|
||||||
|
let path = import.meta.env.VITE_AUTO_URL + "/delivery/add/delivery"
|
||||||
|
axios({
|
||||||
|
method: "put",
|
||||||
|
url: path,
|
||||||
|
data: payload,
|
||||||
|
withCredentials: true,
|
||||||
|
headers: authHeader(),
|
||||||
|
})
|
||||||
|
.then((response: any) => {
|
||||||
|
if (response.data.ok) {
|
||||||
|
notify({
|
||||||
|
text: 'Update',
|
||||||
|
type: 'postive',
|
||||||
|
title: 'top'
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notify({
|
||||||
|
text: 'Auto Failure',
|
||||||
|
type: 'negative',
|
||||||
|
title: 'Update'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
if (this.deliveryOrder.automatic == 1){
|
||||||
|
let auto_payload = {
|
||||||
|
gallons: this.CreateOilOrderForm.basicInfo.gallons_delivered,
|
||||||
|
delivery_id: this.deliveryOrder.id
|
||||||
|
|
||||||
|
}
|
||||||
|
this.UpdateAuto(auto_payload);
|
||||||
|
}
|
||||||
|
|
||||||
let payload = {
|
let payload = {
|
||||||
gallons_delivered: this.CreateOilOrderForm.basicInfo.gallons_delivered,
|
gallons_delivered: this.CreateOilOrderForm.basicInfo.gallons_delivered,
|
||||||
prime: this.CreateOilOrderForm.basicInfo.prime,
|
prime: this.CreateOilOrderForm.basicInfo.prime,
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ export default defineComponent({
|
|||||||
.then((response: any) => {
|
.then((response: any) => {
|
||||||
this.automatic = response.data;
|
this.automatic = response.data;
|
||||||
this.getCustomer(response.data.customer_id);
|
this.getCustomer(response.data.customer_id);
|
||||||
this.sumdelivery(this.$route.params.id);
|
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -167,29 +166,6 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
sumdelivery(delivery_id: any) {
|
|
||||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/total/" + delivery_id;
|
|
||||||
axios({
|
|
||||||
method: "get",
|
|
||||||
url: path,
|
|
||||||
withCredentials: true,
|
|
||||||
})
|
|
||||||
.then((response: any) => {
|
|
||||||
if (response.data.ok) {
|
|
||||||
this.priceprime = response.data.priceprime;
|
|
||||||
this.pricesameday = response.data.pricesameday;
|
|
||||||
this.total_amount = response.data.total_amount;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
notify({
|
|
||||||
title: "Error",
|
|
||||||
text: "Could not get oil pricing",
|
|
||||||
type: "error",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getCustomer(userid: any) {
|
getCustomer(userid: any) {
|
||||||
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
|
let path = import.meta.env.VITE_BASE_URL + '/customer/' + userid;
|
||||||
axios({
|
axios({
|
||||||
|
|||||||
Reference in New Issue
Block a user