Skip to content

Commit

Permalink
Updated UI of bundle modal
Browse files Browse the repository at this point in the history
  • Loading branch information
sab-LC committed Oct 21, 2024
1 parent c6bd8e0 commit 2be3fe3
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 30 deletions.
24 changes: 20 additions & 4 deletions accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,26 @@ def __init__(self, *args, **kwargs):
super(BundleTypeForm, self).__init__(*args, **kwargs)

self.bundle_details = {
'User': {'label': 'User Bundle 5 @ US$1500', 'quantity': 5},
'API': {'label': 'API Bundle 3 @ US$1500', 'quantity': 3},
'Project': {'label': 'Project Bundle 10 @ US$1500', 'quantity': 10},
'Notification': {'label': 'Notification Bundle 10 @ US$1500', 'quantity': 10},
'User': {
'label': 'User Bundle',
'description': 'Add 5 more users to this account.',
'quantity': 5
},
'API': {
'label': 'API Bundle',
'description': 'Add 3 more API keys to this account.',
'quantity': 3
},
'Project': {
'label': 'Project Bundle',
'description': 'Add 10 more projects to this account.',
'quantity': 10
},
'Notification': {
'label': 'Notification Bundle',
'description': 'Add 10 more notifications to this account.',
'quantity': 10
},
}

self.fields['bundle_type'].choices = [
Expand Down
2 changes: 1 addition & 1 deletion accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ def subscription(request, pk, account_type, related=None):
try:
access_token = get_access_token_of_SF(request)
for bundle in form.cleaned_data['bundle_type']:
bundle_data = BundleTypeForm().bundle_details[bundle]
bundle_data = form.bundle_details[bundle]
quantity = bundle_data['quantity']
bundle_data = {
"hubId": str(request.user.id) + "_i",
Expand Down
10 changes: 10 additions & 0 deletions localcontexts/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1844,4 +1844,14 @@ i[data-tooltip]:hover:after {
visibility: visible;
background-color: #EF6C00;
color: #fff;
}

.bundle-modal {
width: 690px;
}

input[type="checkbox"]:focus {
background: none;
border: none;
box-shadow: none;
}
61 changes: 36 additions & 25 deletions templates/account_settings_pages/_subscription.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
{% include 'partials/_alerts.html' %}
<div class="flex-this">
<div>
<button type="submit" class="primary-btn action-btn" name="generatebtn" onclick="openAddModalView()">Update Subscription</button>
<button type="submit" class="primary-btn action-btn" name="generatebtn" onclick="openAddModalView()">Add a bundle<i class="fa-solid fa-plus"></i></button>
</div>
<div class="ml-2p">
<button type="submit" class="primary-btn action-btn" name="generatebtn">Edit Subscription<i class="fa-solid fa-pen-line"></i></button>
</div>
<div class="ml-2p">
<button type="submit" class="primary-btn white-btn" name="generatebtn">Cancel Subscription</button>
Expand All @@ -70,32 +73,40 @@

<div id="bundleModal" class="modal hide">
<span id="bundleModalContent">
<!-- ADD MEMBER MODAL VIEW -->
<div id="addMemberModalView" class="modal-defaults add-member-modal flex-this column w-100">
<div class="flex-this space-between">
<div>
<h2 class="mt-0">Bundles</h2>
<p class="mb-2p">
Add Bundles to increase your resources.
</p>
</div>

<div id='close-model-button' onClick="closeBundleModal()">
<div class="close-modal-btn"><i class="fa-regular fa-xmark fa-xl"></i></div>
</div>
</div>

<div class="w-100 flex-this column">
<form id="addBundleForm" method="POST" action="">
{% csrf_token %}

{{ form.as_p }}
<button type="submit" class="primary-btn action-btn">Submit</button>
<div class="modal-defaults bundle-modal flex-this column w-100">
<div class="flex-this space-between">
<div>
<h2 class="mt-0">Add a Bundle</h2>
<p class="mb-2p">
Upgrade your subscription to unlock additional features. Choose from the available bundles below and submit your request to enhance your experience.
</p>
</div>
<div id='close-model-button' onClick="closeBundleModal()">
<div class="close-modal-btn"><i class="fa-regular fa-xmark fa-xl"></i></div>
</div>
</div>

</form>
</div>
<div class="w-100 flex-this column">
<form method="POST" action="{% if institution %}{% url 'subscription' institution.id 'institution' %}{% else %}{% url 'subscription' researcher.id 'researcher' %}{% endif %}">
{% csrf_token %}
<div id="labelsContainer">
{% for key, bundle in form.bundle_details.items %}
<div class="flex-this flex-start">
<input class="mr-10" type="checkbox" id="label_{{ key }}" name="bundle_type" value="{{ key }}">
<div class="flex-this column ml-16 mt-2p">
<label class="bold" for="label_{{ key }}">{{ bundle.label }}</label>
<p class="mt-0">{{ bundle.description }}</p>
</div>
</div>
{% endfor %}
</div>

<button type="submit" class="primary-btn action-btn w-100 mb-2p">Submit request</button>
<button class="primary-btn white-btn w-100 darkteal-text" onClick="closeBundleModal()">Cancel</button>
</form>
</div>

</div>
</div>
</span>
</div>

Expand Down

0 comments on commit 2be3fe3

Please sign in to comment.