Anwesenheit und Spiel speichern und Teilnehmerliste nur für Admins
This commit is contained in:
parent
a729c184eb
commit
87a51c5b6e
4
app.js
4
app.js
|
@ -653,7 +653,7 @@ app.get('/riege', requireAuth, async (req, res) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/teilnehmer', requireAuth, async (req, res) => {
|
app.get('/teilnehmer', requireAuth, requireAdmin, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const teilnehmendeResult = await pool.query('SELECT * FROM teilnehmende ORDER BY helfer DESC, vorname ASC');
|
const teilnehmendeResult = await pool.query('SELECT * FROM teilnehmende ORDER BY helfer DESC, vorname ASC');
|
||||||
|
|
||||||
|
@ -670,7 +670,7 @@ app.get('/teilnehmer', requireAuth, async (req, res) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/mitglied/:id', requireAuth, async (req, res) => {
|
app.get('/mitglied/:id', requireAuth, requireAdmin, async (req, res) => {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
try {
|
try {
|
||||||
var riege = 0;
|
var riege = 0;
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/riege">Riegen</a>
|
<a class="nav-link" href="/riege">Riegen</a>
|
||||||
</li>
|
</li>
|
||||||
|
<% if (session && session.role === 'admin') { %>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/teilnehmer">Teilnehmende</a>
|
<a class="nav-link" href="/teilnehmer">Teilnehmende</a>
|
||||||
</li>
|
</li>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/profile">Profil</a>
|
<a class="nav-link" href="/profile">Profil</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -52,7 +52,9 @@
|
||||||
<option value="<%= candidate.id %>"><%= candidate.name %> (<%= Math.floor(candidate.weeks_since_last) %> Wochen)</option>
|
<option value="<%= candidate.id %>"><%= candidate.name %> (<%= Math.floor(candidate.weeks_since_last) %> Wochen)</option>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</select>
|
</select>
|
||||||
|
<% if (session && session.role === 'admin') { %>
|
||||||
<button type="submit">Speichern</button>
|
<button type="submit">Speichern</button>
|
||||||
|
<% } %>
|
||||||
</form></p>
|
</form></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
@ -70,7 +72,9 @@
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</datalist>
|
</datalist>
|
||||||
<input list="spiele" id="spielName" name="spielName">
|
<input list="spiele" id="spielName" name="spielName">
|
||||||
|
<% if (session && session.role === 'admin') { %>
|
||||||
<button type="submit">Speichern</button>
|
<button type="submit">Speichern</button>
|
||||||
|
<% } %>
|
||||||
</form></p>
|
</form></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,7 +94,9 @@
|
||||||
<option value="<%= candidate.id %>"><%= candidate.name %> (<%= Math.floor(candidate.weeks_since_last) %> Wochen)</option>
|
<option value="<%= candidate.id %>"><%= candidate.name %> (<%= Math.floor(candidate.weeks_since_last) %> Wochen)</option>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</select>
|
</select>
|
||||||
|
<% if (session && session.role === 'admin') { %>
|
||||||
<button type="submit">Speichern</button>
|
<button type="submit">Speichern</button>
|
||||||
|
<% } %>
|
||||||
</form></p>
|
</form></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
@ -110,7 +116,9 @@
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</datalist>
|
</datalist>
|
||||||
<input list="spiele" id="spielName" name="spielName">
|
<input list="spiele" id="spielName" name="spielName">
|
||||||
|
<% if (session && session.role === 'admin') { %>
|
||||||
<button type="submit">Speichern</button>
|
<button type="submit">Speichern</button>
|
||||||
|
<% } %>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@ -157,7 +165,9 @@
|
||||||
</table>
|
</table>
|
||||||
<input type="hidden" name="trainingId" value="<%= training.id %>">
|
<input type="hidden" name="trainingId" value="<%= training.id %>">
|
||||||
<input type="hidden" name="riege" value="<%= riegennummer %>">
|
<input type="hidden" name="riege" value="<%= riegennummer %>">
|
||||||
|
<% if (session && session.role === 'admin') { %>
|
||||||
<button type="submit">Speichern</button>
|
<button type="submit">Speichern</button>
|
||||||
|
<% } %>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
|
|
Loading…
Reference in New Issue