working auto
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
</div>
|
||||
|
||||
<div class="pt-2">
|
||||
<button type="submit" class="btn btn-secondary btn-sm">Finalize Delivery</button>
|
||||
<button type="submit" class="btn btn-success btn-sm">Finalize Delivery</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -497,6 +497,19 @@
|
||||
},
|
||||
|
||||
|
||||
closeTicket(ticketId: number) {
|
||||
let path = import.meta.env.VITE_AUTO_URL + "/confirm/auto/close_ticket/" + ticketId;
|
||||
axios({
|
||||
method: "put",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then(() => {
|
||||
// Ticket closed successfully
|
||||
})
|
||||
},
|
||||
|
||||
UpdateDeliveredAuto(payload: {
|
||||
gallons_delivered: string,
|
||||
}) {
|
||||
@@ -516,7 +529,7 @@
|
||||
text: "Auto Updated",
|
||||
type: "success",
|
||||
});
|
||||
this.$router.push({ name: "payAutoCapture", params: { id: this.autoTicket.id } });
|
||||
// Removed redirect from here, will handle in onSubmit
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -554,12 +567,20 @@
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
|
||||
let payload = {
|
||||
gallons_delivered: this.FinalizeOilOrderForm.gallons_delivered,
|
||||
};
|
||||
this.UpdateDeliveredAuto(payload);
|
||||
|
||||
if (this.autoTicket.payment_status == '1') {
|
||||
// Pre-authorized: redirect to capture page
|
||||
this.$router.push({ name: "payAutoCapture", params: { id: this.autoTicket.id } });
|
||||
} else {
|
||||
// Fully charged: close ticket
|
||||
if (this.autoDelivery.open_ticket_id) {
|
||||
this.closeTicket(this.autoDelivery.open_ticket_id);
|
||||
}
|
||||
this.$router.push({ name: "auto" });
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user