feat: allow final destination to mark DO as completed

This commit is contained in:
Dylan Wright 2025-06-05 17:43:55 +10:00
parent b542047398
commit 410738459d
4 changed files with 60 additions and 11 deletions

14
.idea/discord.xml generated Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT" />
<option name="description" value="" />
<option name="applicationTheme" value="default" />
<option name="iconsTheme" value="default" />
<option name="button1Title" value="" />
<option name="button1Url" value="" />
<option name="button2Title" value="" />
<option name="button2Url" value="" />
<option name="customApplicationId" value="" />
</component>
</project>

36
.idea/workspace.xml generated
View File

@ -4,12 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="5112d569-3a3f-4a44-9bd9-2c9295e7fe64" name="Changes" comment="Login and Dashboard added"> <list default="true" id="5112d569-3a3f-4a44-9bd9-2c9295e7fe64" name="Changes" comment="added readme">
<change afterPath="$PROJECT_DIR$/app/templates/do_entry.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/templates/move_do.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/templates/track_do.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/routes.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/routes.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -34,9 +30,9 @@
<component name="HighlightingSettingsPerFile"> <component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/run.py" root0="FORCE_HIGHLIGHTING" /> <setting file="file://$PROJECT_DIR$/run.py" root0="FORCE_HIGHLIGHTING" />
</component> </component>
<component name="ProjectColorInfo"><![CDATA[{ <component name="ProjectColorInfo">{
"associatedIndex": 2 &quot;associatedIndex&quot;: 2
}]]></component> }</component>
<component name="ProjectId" id="2xzZKYTQ3ONQyWMQvvsDEzRY2pu" /> <component name="ProjectId" id="2xzZKYTQ3ONQyWMQvvsDEzRY2pu" />
<component name="ProjectLevelVcsManager"> <component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" /> <ConfirmationsSetting value="2" id="Add" />
@ -52,7 +48,7 @@
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true", "RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "main", "git-widget-placeholder": "main",
"settings.editor.selected.configurable": "preferences.lookFeel" "settings.editor.selected.configurable": "discord-application"
} }
}]]></component> }]]></component>
<component name="TaskManager"> <component name="TaskManager">
@ -103,7 +99,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1748944937448</updated> <updated>1748944937448</updated>
</task> </task>
<option name="localTasksCounter" value="6" /> <task id="LOCAL-00006" summary="Tracking DOs and other stuff added">
<option name="closed" value="true" />
<created>1748945875048</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1748945875048</updated>
</task>
<task id="LOCAL-00007" summary="added readme">
<option name="closed" value="true" />
<created>1748946041819</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1748946041819</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -148,6 +160,8 @@
<MESSAGE value="First Commit" /> <MESSAGE value="First Commit" />
<MESSAGE value="Web front enabled basic flask setup" /> <MESSAGE value="Web front enabled basic flask setup" />
<MESSAGE value="Login and Dashboard added" /> <MESSAGE value="Login and Dashboard added" />
<option name="LAST_COMMIT_MESSAGE" value="Login and Dashboard added" /> <MESSAGE value="Tracking DOs and other stuff added" />
<MESSAGE value="added readme" />
<option name="LAST_COMMIT_MESSAGE" value="added readme" />
</component> </component>
</project> </project>

View File

@ -134,3 +134,19 @@ def move_do():
return redirect(url_for('main.track_do')) return redirect(url_for('main.track_do'))
return render_template("move_do.html") return render_template("move_do.html")
@main.route('/store/complete/<int:do_id>', methods=['POST'])
def mark_completed(do_id):
if 'store_id' not in session:
return redirect(url_for('auth.login'))
do = DeliveryOrder.query.get_or_404(do_id)
# Ensure only the final destination can mark complete
if session['store_id'] != do.final_location:
flash("You are not authorized to mark this DO as completed.", "danger")
return redirect(url_for('main.track_do'))
do.status = "Completed"
db.session.commit()
flash("DO marked as completed.", "success")
return redirect(url_for('main.track_do'))

View File

@ -19,6 +19,11 @@
<p>Final Destination: {{ do.final_location }}</p> <p>Final Destination: {{ do.final_location }}</p>
<p>Collected By: {{ do.collected_by if do.collected_by else "Not collected yet" }}</p> <p>Collected By: {{ do.collected_by if do.collected_by else "Not collected yet" }}</p>
<p>Created: {{ do.created_at }}</p> <p>Created: {{ do.created_at }}</p>
{% if do.status != "Completed" and session['store_id'] == do.final_location %}
<form action="/store/complete/{{ do.id }}" method="POST">
<button type="submit">✅ Mark as Delivered</button>
</form>
{% endif %}
<h3>Movement History:</h3> <h3>Movement History:</h3>
{% if movements %} {% if movements %}