-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
81bfbb7
commit d1c6b77
Showing
5 changed files
with
162 additions
and
46 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
migrations/versions/9083452d3a80_add_catagory_user_associations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""add catagory_user_associations | ||
Revision ID: 9083452d3a80 | ||
Revises: 48074e6225c6 | ||
Create Date: 2024-02-16 21:38:11.302398 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "9083452d3a80" | ||
down_revision = "48074e6225c6" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table( | ||
"catagory_user_associations", | ||
sa.Column("category_uuid", sa.String(), nullable=True), | ||
sa.Column("user_id", sa.String(), nullable=True), | ||
sa.ForeignKeyConstraint( | ||
["category_uuid"], | ||
["category.uuid"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["user_id"], | ||
["user.id"], | ||
), | ||
) | ||
|
||
|
||
def downgrade(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
subscribie/blueprints/admin/templates/admin/user_assign_plan.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{% extends "admin/layout.html" %} | ||
{% block title %} {{ title }} {% endblock %} | ||
|
||
{% block body %} | ||
|
||
<h2 class="text-center text-dark mb-3">Choice Group - Assign Plan</h2> | ||
|
||
<div class="container"> | ||
<ul class="breadcrumb"> | ||
<li class="breadcrumb-item"><a href="/">Shop</a></li> | ||
<li class="breadcrumb-item"><a href="{{ url_for('admin.dashboard') }}">Manage My Shop</a></li> | ||
<li class="breadcrumb-item"><a href="{{ url_for('admin.assign_managers_to_plan') }}">Assign Manager(s) to Plan(s)</a></li> | ||
<li class="breadcrumb-item active" aria-current="page">Assign user to plan(s)</li> | ||
</ul> | ||
</div> | ||
|
||
<main> | ||
<div class="section"> | ||
<div class="container"> | ||
|
||
<h3>Assign Plan(s) to user: <em>{{ user.email }}</em></h3> | ||
<p class="card-subtitle text-muted">Tick which plan(s) you want to assign the user to</p> | ||
<p class="card-subtitle text-muted mb-3">Doing so will make these plans(s) and any associated subscriptions appear more prominently for them when they login.</p> | ||
|
||
<hr> | ||
<div class="btn btn-success mb-4" onclick="toggleCheckboxes(true)">Check all</div> | ||
<div class="btn btn-success mb-4" onclick="toggleCheckboxes(false)">Check none</div> | ||
<form action="" method="POST" class="col-md-7 py-3"> | ||
{% for plan in plans %} | ||
{% if plan.subscriptions | length > 0 %} | ||
<div class="input-group mb-3"> | ||
<div class="input-group-prepend"> | ||
<div class="input-group-text"> | ||
<input type="checkbox" name="assign" class="assign-plan-to-manager-checkbox" value="{{ plan.id }}" id="{{ plan.id }}" | ||
{% if user in plan.managers %} | ||
checked | ||
{% endif %}> | ||
</div> | ||
</div> | ||
<label class="form-control" for="{{ plan.id }}">{{ plan.title }}</label> {{ plan.archived }}| Subscriptions: {{ plan.subscriptions|length }} | ||
</div> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
<input type="submit" class="btn btn-success btn-block" value="Save" /> | ||
</form> | ||
|
||
</div><!--end container--> | ||
</div><!--end section--> | ||
</main> | ||
|
||
<script> | ||
function toggleCheckboxes(toggle) { | ||
checkboxes = document.getElementsByClassName('assign-plan-to-manager-checkbox') | ||
for (i=0; i<checkboxes.length;i++) { | ||
checkboxes[i].checked = toggle; | ||
} | ||
} | ||
</script> | ||
|
||
{% endblock body %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters