Namen der Mitglieder bearbeitbar
This commit is contained in:
parent
ebf7e6823e
commit
dbdd7a2176
19
app.js
19
app.js
|
@ -844,8 +844,19 @@ app.post("/set-riege", requireAuth, async (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/update-mitglied", requireAdmin, async (req, res) => {
|
app.post("/update-mitglied", requireAdmin, async (req, res) => {
|
||||||
const { type, id, geburt, telid, adresse, name, verbindung, nummer, probe } =
|
const {
|
||||||
req.body;
|
type,
|
||||||
|
id,
|
||||||
|
geburt,
|
||||||
|
telid,
|
||||||
|
adresse,
|
||||||
|
name,
|
||||||
|
verbindung,
|
||||||
|
nummer,
|
||||||
|
vorname,
|
||||||
|
nachname,
|
||||||
|
probe,
|
||||||
|
} = req.body;
|
||||||
try {
|
try {
|
||||||
if (type == "tel") {
|
if (type == "tel") {
|
||||||
console.log(
|
console.log(
|
||||||
|
@ -861,8 +872,8 @@ app.post("/update-mitglied", requireAdmin, async (req, res) => {
|
||||||
console.log("delete numer $1", [telid]);
|
console.log("delete numer $1", [telid]);
|
||||||
} else if (type == "adresse") {
|
} else if (type == "adresse") {
|
||||||
await pool.query(
|
await pool.query(
|
||||||
"UPDATE teilnehmende SET geburtsdatum = $1, adresse = $2, probe = $3 WHERE id = $4",
|
"UPDATE teilnehmende SET vorname = $1, nachname = $2, geburtsdatum = $3, adresse = $4, probe = $5 WHERE id = $6",
|
||||||
[geburt, adresse, probe ? true : false, id]
|
[vorname, nachname, geburt, adresse, probe ? true : false, id]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,18 +32,45 @@
|
||||||
<div id="edit" class="mt-5 d-none">
|
<div id="edit" class="mt-5 d-none">
|
||||||
|
|
||||||
<form method="POST" action="/update-mitglied">
|
<form method="POST" action="/update-mitglied">
|
||||||
Geburtsdatum: <input type="date" id="geburt" name="geburt" value="<%= birthday.getFullYear() %>-<%= ('00' + (birthday.getMonth() + 1)).slice(-2) %>-<%= ('00' + birthday.getDate()).slice(-2) %>"></br>
|
<fieldset class="scheduler-border">
|
||||||
|
<legend >Stammdaten</legend>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="vorname">Vorname:</label>
|
||||||
|
<input class="form-control" name="vorname" type="text" value="<%= mitglied.vorname %>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="nachname">Nachname:</label>
|
||||||
|
<input class="form-control" name="nachname" type="text" value="<%= mitglied.nachname %>"></br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="geburt">Geburtsdatum:</label>
|
||||||
|
<input type="date" id="geburt" name="geburt" value="<%= birthday.getFullYear() %>-<%= ('00' + (birthday.getMonth() + 1)).slice(-2) %>-<%= ('00' + birthday.getDate()).slice(-2) %>"></br>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="id" value="<%= id %>">
|
<input type="hidden" name="id" value="<%= id %>">
|
||||||
<input type="hidden" name="type" value="adresse">
|
<input type="hidden" name="type" value="adresse">
|
||||||
<strong> Adresse: </strong> <input name="adresse" type="text" value="<%= mitglied.adresse %>"></br>
|
|
||||||
<strong> Probetraining: </strong> <input type="checkbox" name="probe" value="true" <%= mitglied.probe ? 'checked' : '' %>></br>
|
<div class="form-group col-md-3">
|
||||||
<button type="submit">Speichern</button>
|
<label for="adresse"> Adresse: </label>
|
||||||
|
<input class="form-control" name="adresse" type="text" value="<%= mitglied.adresse %>"></br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label for="probe"> Probetraining: </label>
|
||||||
|
<input class="form-check-input" type="checkbox" name="probe" value="true" <%= mitglied.probe ? 'checked' : '' %>></br>
|
||||||
|
|
||||||
|
<button class="btn btn-success" type="submit">Speichern</button>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<form method="POST" action="/set-Riege">
|
<form method="POST" action="/set-Riege">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Riege</legend>
|
||||||
<input type="hidden" name="id" value="<%= id %>">
|
<input type="hidden" name="id" value="<%= id %>">
|
||||||
<strong>Riege: </strong><select name="riege">
|
<strong>Riege: </strong><select class="custom-select" name="riege">
|
||||||
<option value=0 <% if ( riege === 0) { %> selected <% } %>> keine</option>
|
<option value=0 <% if ( riege === 0) { %> selected <% } %>> keine</option>
|
||||||
<option value=1 <% if ( riege === 1) { %> selected <% } %>> Riege 1</option>
|
<option value=1 <% if ( riege === 1) { %> selected <% } %>> Riege 1</option>
|
||||||
<option value=2 <% if ( riege === 2) { %> selected <% } %>> Riege 2</option>
|
<option value=2 <% if ( riege === 2) { %> selected <% } %>> Riege 2</option>
|
||||||
|
@ -52,8 +79,11 @@
|
||||||
<option value=5 <% if ( riege === 5) { %> selected <% } %>> Riege 5</option>
|
<option value=5 <% if ( riege === 5) { %> selected <% } %>> Riege 5</option>
|
||||||
</select>
|
</select>
|
||||||
<button type="submit">Speichern</button>
|
<button type="submit">Speichern</button>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Notfallnummern</legend>
|
||||||
<p>
|
<p>
|
||||||
<% numbers.forEach(number => { %>
|
<% numbers.forEach(number => { %>
|
||||||
<form method="POST" action="/update-mitglied">
|
<form method="POST" action="/update-mitglied">
|
||||||
|
@ -65,7 +95,7 @@
|
||||||
</form>
|
</form>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</p>
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<h2>Telefonnummer hinzufügen</h2>
|
<h2>Telefonnummer hinzufügen</h2>
|
||||||
<form method="POST" action="/update-mitglied">
|
<form method="POST" action="/update-mitglied">
|
||||||
|
|
Loading…
Reference in New Issue