Add pay action to form
This commit is contained in:
8
app.py
8
app.py
@@ -157,6 +157,12 @@ def index():
|
||||
"out",
|
||||
client_timestamp
|
||||
)
|
||||
elif action == "pay":
|
||||
# Update the paid column for all entries for the selected user to True
|
||||
create_entry(
|
||||
selected_user_id,
|
||||
"pay"
|
||||
)
|
||||
elif action == "report":
|
||||
begin_date = request.form.get("begin_date")
|
||||
end_date = request.form.get("end_date")
|
||||
@@ -219,7 +225,7 @@ def api_create_entry():
|
||||
entry_type = data.get("entrytype")
|
||||
client_timestamp = data.get("timestamp")
|
||||
paid = data.get("paid", False)
|
||||
if entry_type not in ("in", "out"):
|
||||
if entry_type not in ("in", "out", "pay"):
|
||||
return jsonify({
|
||||
"error": "Invalid entrytype"
|
||||
}), 400
|
||||
|
||||
@@ -111,6 +111,15 @@
|
||||
Clock Out
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
name="action"
|
||||
value="pay"
|
||||
onclick="setCurrentTimestamp()"
|
||||
>
|
||||
Pay
|
||||
</button>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user