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