Skip to content

Commit

Permalink
fix bug add convention from operation
Browse files Browse the repository at this point in the history
  • Loading branch information
etchegom committed Feb 12, 2025
1 parent 9f5f415 commit 5beafa2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 10 additions & 1 deletion conventions/views/convention_form_from_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,20 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
def _handle(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
numero_operation = kwargs.get("numero_operation")

# TODO: handle null operation and user rights
operation = SelectOperationService(
request=request, numero_operation=numero_operation
).get_operation()

if not operation:
messages.add_message(
request,
messages.ERROR,
f"L'opération {numero_operation} n'a pas été trouvée dans Apilos.",
)
return HttpResponseRedirect(
reverse("conventions:from_operation_select"),
)

service = AddConventionService(request=request, operation=operation)
if request.method == "POST":
save_status = service.save()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@
<script type="text/javascript" nonce="{{request.csp_nonce}}">
rows = document.querySelectorAll('tr.clickable')
rows.forEach(row => {
numero = row.children[0].textContent
row.addEventListener("click", () => {
window.location = "from_operation/add_convention/" + encodeURIComponent(numero)
row.addEventListener("click", (e) => {
window.location = "from_operation/add_convention/" + encodeURIComponent(e.currentTarget.children[0].textContent)
})
});
</script>
Expand Down

0 comments on commit 5beafa2

Please sign in to comment.