Skip to content

Commit

Permalink
Setup modal for Verwijder taak
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohoff committed Sep 25, 2023
1 parent 15926be commit da0ed01
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 1 deletion.
27 changes: 27 additions & 0 deletions app/apps/regie/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,33 @@ def __init__(self, *args, **kwargs):
self.fields["taaktype"].choices = taaktypes


class TaakVerwijderenForm(forms.Form):
taaktype = forms.ChoiceField(
widget=forms.Select(),
label="Taak",
choices=(
("graf_ophogen", "Graf ophogen"),
("steen_rechtzetten", "Steen rechtzetten"),
("snoeien", "Snoeien"),
),
required=True,
)

bericht = forms.CharField(
label="Interne opmerking",
help_text="Deze tekst wordt niet naar de melder verstuurd.",
widget=forms.Textarea(
attrs={"class": "form-control", "data-testid": "information", "rows": "4"}
),
required=False,
)

def __init__(self, *args, **kwargs):
taaktypes = kwargs.pop("taaktypes", None)
super().__init__(*args, **kwargs)
self.fields["taaktype"].choices = taaktypes


class TaakAfrondenForm(forms.Form):
status = forms.ChoiceField(
widget=RadioSelect(
Expand Down
11 changes: 10 additions & 1 deletion app/apps/regie/templates/melding/melding_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ <h3 class="h5">Is terugkoppeling gewenst?</h3>
<button type="button" class="btn btn-{% if melding.status.naam == 'controle' %}action{%else%}tertiary{%endif%}" data-action="detail#openModal" data-detail-action-param="{% url 'melding_afhandelen' melding.uuid %}"><span>Melding afhandelen</span></button>
{% endif %}
</p>
<p>
<button type="button" class="btn btn-icon btn-textlink" data-action="detail#openModal" data-detail-action-param="{% url 'taak_verwijderen' melding.uuid %}">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" title="">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.875 1.425H4.125L3.13577 5.25H5.25V3.075H12.75V5.25L14.8642 5.25L13.875 1.425ZM16.3816 5.25L15.375 1.425L15 0H14.25H3.75H3L2.625 1.425L2.625 1.425L1.61842 5.25H0.75V6.75H1.62805L3 18H3.75H14.25H15L16.3719 6.75H17.25V5.25H16.3816ZM13.6594 16.5L14.8781 6.75H3.12188L4.34063 16.5H13.6594Z" fill="#00811F"/>
</svg>
Verwijder taak
</button>
</p>
<p>
<a href="{% url 'melding_pdf_download' melding.uuid %}" target="_blank" role="button" class="btn btn-icon btn-textlink">
<svg width="16" height="16" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg" title="">
Expand Down Expand Up @@ -310,10 +318,11 @@ <h3 class="h5">Is terugkoppeling gewenst?</h3>
</div>

<div class="modal" data-controller="detail">
<div class="modal-backdrop modal-exit" id="modal-backdrop"data-action="click->detail#closeModal"></div>
<div class="modal-backdrop modal-exit" id="modal-backdrop" data-action="click->detail#closeModal"></div>
<turbo-frame id="melding_actie_form" class="turboframe-container" data-detail-target="turboActionModal" src="{% url 'melding_afhandelen' melding.uuid %}" loading="lazy">

</turbo-frame>
</div>

</turbo-frame>
{% endblock body %}
56 changes: 56 additions & 0 deletions app/apps/regie/templates/melding/part_taak_verwijderen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{% load rotterdam_formulier_html %}
{% load vind_in_dict from querystring_tags %}
{% load to_date from date_tags %}
{% load json_encode from json_tags %}

<turbo-frame id="melding_actie_form">
<div class="modal-dialog modal-dialog--small">
<div class="modal-content">
<div class="modal-header">
<h1>
<span>Verwijder taak</span>
</h1>
<button
type="button"
class="btn-close"
aria-label="Sluit"
data-action="detail#closeModal">
</button>
</div>
<div class="modal-body">
<form
action="{% url 'taak_verwijderen' melding.uuid %}"
method="post"
class="form--horizontal"
data-controller=""
data-turbo-frame="_top"
enctype="multipart/form-data"
>

{% csrf_token %}

{{ form.taaktype|render_rotterdam_formulier }}
<div class="form-control__with-helptext">
{{ form.bericht|render_rotterdam_formulier }}
</div>
<div class="form-row btn-row">
<button
type="reset"
class="btn btn-tertiary"
data-controller="detail"
data-action="detail#closeModal"
>
<span>Annuleren</span>
</button>
<button
type="submit"
class="btn btn-action"
>
<span>Verwijder taak</span>
</button>
</div>
</form>
</div>
</div>
</div>
</turbo-frame>
1 change: 1 addition & 0 deletions app/apps/regie/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
TaakAfrondenForm,
TaakAnnulerenForm,
TaakStartenForm,
TaakVerwijderenForm,
)
from apps.regie.utils import melding_naar_tijdlijn, to_base64
from config.context_processors import general_settings
Expand Down
1 change: 1 addition & 0 deletions app/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
taak_afronden,
taak_annuleren,
taak_starten,
taak_verwijderen,
)
from django.conf import settings
from django.conf.urls.static import static
Expand Down
1 change: 1 addition & 0 deletions app/frontend/assets/controllers/detail_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class extends Controller {
}

openModal(event) {
console.log("openModal, src: ", event.params.action)
lastFocussedItem = event.target.closest('button')
const modal = document.querySelector('.modal')
const modalBackdrop = document.querySelector('.modal-backdrop')
Expand Down
4 changes: 4 additions & 0 deletions app/frontend/assets/styles/components/_incident-details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
display: inline-block;
font-size: 16px;
margin-right: 4px;

&-textlink {
text-decoration: underline;
}
}

.list__mutations {
Expand Down

0 comments on commit da0ed01

Please sign in to comment.