I am trying to get it so that when a user goes to /checkout that they can enter a number and user then save it. My issue is having it so when they are at the view all / show page that they click checkout and it takes them to /checkout/:id. I got that part which is easy but how do I access that ID from the URL inside my template?
Here is my form:
<form role="form-inline"action="/dashboard/it/expendable/checkout?_method=PUT" method="POST">
<div class="form-group col-md-4">
<label for="name" class="control-label">Number of units checked out</label>
<input type="number" class="form-control" id="name" name="checkoutNum" placeholder="# Units">
</div><!-- Number Checkout -->
</form>
My route:
// checkout expendable
app.get('/dashboard/it/expendable/checkout/:id',
setRedirect({auth: '/login'}),
isAuthenticated,
(req, res, next) => {
next();
},
setRender('dashboard/it/checkoutExpendable'),
dashboard.getDefault);
I need the ID from the URL to be able to be passed to my PUT route to save the data mainly the number of units taken. I plan to have it so it creates a new checked out document then updates the expendable quantity from an existing document.