Skip to content

Commit

Permalink
Picking a slot page now requests the next week for correct resource f…
Browse files Browse the repository at this point in the history
…rom the API. Part of #9
  • Loading branch information
Adrian McEwen committed Oct 3, 2020
1 parent 4a3bd3b commit 1a07607
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion website/routes/select-a-time.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const express = require('express');
const axios = require('axios');
const moment = require('moment');
const utilities = require('../utilities');
const settings = require('../settings');

Expand All @@ -15,8 +16,12 @@ router.get('/select-a-time', function (req, res) {
console.log('No resource id');
}

// Default to showing the next week...
const fromDate = moment();
const toDate = moment().add(6, 'days')

const resourceUrl = `${apiUrl}/resources/${resourceId}`;
const calendarUrl = `${apiUrl}/calendar/2020-08-25/2020-09-01/1`;
const calendarUrl = `${apiUrl}/calendar/${fromDate.format('YYYY-MM-DD')}/${toDate.format('YYYY-MM-DD')}/${resourceId}`;
const templateVariables = {};

axios.get(resourceUrl)
Expand Down
4 changes: 2 additions & 2 deletions website/templates/select-a-time.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2>
<div class="calendar">
{% for d in calendar.dates %}
{% for r in d.resources %}
<p>Resource name: {{r.resourceName}}</p>
<p>{{ d.date }} Resource name: {{r.resourceName}}</p>
{% endfor %}
{% endfor %}
</div>
Expand All @@ -42,4 +42,4 @@ <h3>UI to display and select available slots for the resource to go here</h3>

</main>

{% endblock %}
{% endblock %}

0 comments on commit 1a07607

Please sign in to comment.