Skip to content

Commit

Permalink
changed success messages, changed some save buttons, added back sort …
Browse files Browse the repository at this point in the history
…code function

Signed-off-by: Trey <[email protected]>
  • Loading branch information
TreyWW committed Oct 6, 2024
1 parent 345509f commit c8564ee
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/api/invoices/recurring/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def edit_invoice_recurring_profile_endpoint(request: WebRequest, invoice_profile
invoice_profile.save()

if request.htmx:
messages.success(request, "Invoice edited")
messages.success(request, "Successfully saved profile!")
return render(request, "base/toasts.html")

return JsonResponse({"message": "Invoice successfully edited"}, status=200)
1 change: 0 additions & 1 deletion billing/views/return_urls/success.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@


def stripe_success_return_endpoint(request: WebRequest):
messages.warning(request, "SUCCESS RESPONSE")
return redirect("billing:dashboard")
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,24 @@
</div>
</div>
</div>
<script>
function validate_sort_code(value) {
// Remove any non-numeric characters
value = value.replace(/\D/g, '');

// Ensure the value is no longer than 9 characters (123-123-123)
if (value.length > 6) {
value = value.slice(0, 6);
}

// Format the value as "12-34-56"
if (value.length >= 2) {
value = value.slice(0, 2) + "-" + value.slice(2);
}
if (value.length >= 5) {
value = value.slice(0, 5) + "-" + value.slice(5);
}

return value;
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ <h3 class="text-sm text-natural font-semibold hidden lg:block text-end me-6">To<
{# {% include "pages/invoices/create/notes/notes.html" %}#}
<div class="group-invalid:tooltip"
data-tip="Fill out all required details to save the invoice.">
<button class="btn btn-primary group-invalid:btn-disabled btn-block">Edit profile</button>
<button class="btn btn-primary group-invalid:btn-disabled btn-block"
onclick="window.scrollTo(0,0)">Save profile</button>
</div>
</form>
<script>
Expand Down
3 changes: 1 addition & 2 deletions frontend/templates/pages/invoices/single/edit/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ <h3 class="text-sm text-natural font-semibold hidden lg:block text-end me-6">To<
{% include "pages/invoices/create/custom_designs/logo.html" %}
<div class="group-invalid:tooltip mt-4"
data-tip="Fill out all required details to save the invoice.">
<button class="btn btn-primary group-invalid:btn-disabled btn-block">Update Invoice</button>
<button class="btn btn-primary group-invalid:btn-disabled btn-block">Save Invoice</button>
</div>
</form>
<!-- still need to add SERVICE & PAYMENT INFORMATION fields for editing -->
{% endblock content %}

0 comments on commit c8564ee

Please sign in to comment.