Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revision date in list & edit intended start date #570

Merged
merged 8 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified locale/en/LC_MESSAGES/django.mo
Binary file not shown.
474 changes: 199 additions & 275 deletions locale/en/LC_MESSAGES/django.po

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions proposals/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .validators import UniqueTitleValidator
from .widgets import SelectMultipleUser, SelectUser

from cdh.core.forms import DateField

class ProposalForm(UserKwargModelFormMixin, SoftValidationMixin,
ConditionalModelForm):
Expand Down Expand Up @@ -574,6 +575,15 @@ class Meta:
'dmp_file'
]

class ProposalUpdateDateStartForm(forms.ModelForm):
date_start = DateField(label=_('Nieuwe beoogde startdatum'))

class Meta:
model = Proposal
fields = [
'date_start'
]

class ProposalSubmitForm(forms.ModelForm):
class Meta:
model = Proposal
Expand Down
33 changes: 33 additions & 0 deletions proposals/templates/proposals/proposal_update_date_start.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends "base/base.html" %}

{% load static %}
{% load i18n %}

{% block header_title %}
{% trans "Formulieren aanpassen" %} - {{ block.super }}
{% endblock %}

{% block content %}
<div class="uu-inner-container">
<div class="col-12">
<h2>
{% trans "Startdatum aanpassen" %}
</h2>
<p>
{% blocktrans trimmed with title=proposal.title ref_number=proposal.reference_number %}
Op deze pagina kan de startdatum worden aangepast van de aanvraag {{ title }}
(referentienummer <em>{{ ref_number }}</em>). <b>Let op!</b> Als de review al is afgerond,
wordt de nieuwe startdatum niet automatisch weergegeven in de PDF. Mocht je de PDF
opnieuw willen genereren, neem hierover dan contact op met
{% endblocktrans %}
<a href="mailto:[email protected]">[email protected]</a>.
</p>
<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}
<table>{{ form.as_table }}</table>
<input type="hidden" name="next" value="{{ request.META.HTTP_REFERER }}">
<input class="pure-button pure-button-primary" type="submit" value="{% trans 'Startdatum aanpassen' %}" />
<a class="pure-button pure-button-secondary" href="javascript:history.go(-1);">{% trans "Terug naar de vorige pagina" %}</a>
</form>
</div>
</div>
{% endblock %}
5 changes: 4 additions & 1 deletion proposals/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
ProposalSubmitPreApproved, ProposalUpdatePreApproved, \
ProposalUsersOnlyArchiveView, \
ProposalCopyAmendment, ProposalsPublicArchiveView, \
ProposalUpdateDataManagement, TranslatedConsentFormsView
ProposalUpdateDataManagement, TranslatedConsentFormsView, \
ProposalUpdateDateStart

from .views.study_views import StudyStart, StudyConsent
from .views.wmo_views import WmoCreate, WmoUpdate, \
Expand Down Expand Up @@ -84,6 +85,8 @@
name='data_management'),
path('update_data_management/<int:pk>/', ProposalUpdateDataManagement.as_view(),
name='update_data_management'),
path('update_date_start/<int:pk>/', ProposalUpdateDateStart.as_view(),
name='update_date_start'),

path('submit/<int:pk>/', include([
path('', ProposalSubmit.as_view(), name='submit'),
Expand Down
15 changes: 14 additions & 1 deletion proposals/views/proposal_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
from ..forms import ProposalConfirmationForm, ProposalCopyForm, \
ProposalDataManagementForm, ProposalForm, ProposalStartPracticeForm, \
ProposalSubmitForm, RevisionProposalCopyForm, AmendmentProposalCopyForm, \
ProposalUpdateDataManagementForm, TranslatedConsentForms
ProposalUpdateDataManagementForm, ProposalUpdateDateStartForm, \
TranslatedConsentForms
from ..models import Proposal, Wmo
from ..utils import generate_pdf, generate_ref_number
from proposals.mixins import ProposalMixin, ProposalContextMixin, \
Expand Down Expand Up @@ -375,7 +376,19 @@ class ProposalUpdateDataManagement(GroupRequiredMixin, generic.UpdateView):
def get_success_url(self):
"""Continue to the URL specified in the 'next' POST parameter"""
return reverse('reviews:detail', args=[self.object.latest_review().pk])

class ProposalUpdateDateStart(GroupRequiredMixin, generic.UpdateView):
"""
Allows the secretary to change the date_start on the Proposal level
"""
model = Proposal
template_name = 'proposals/proposal_update_date_start.html'
form_class = ProposalUpdateDateStartForm
group_required = settings.GROUP_SECRETARY

def get_success_url(self):
"""Continue to the URL specified in the 'next' POST parameter"""
return reverse('reviews:detail', args=[self.object.latest_review().pk])

class ProposalSubmit(ProposalContextMixin, AllowErrorsOnBackbuttonMixin, UpdateView, ):
model = Proposal
Expand Down
2 changes: 2 additions & 0 deletions reviews/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ def get_context(self):
'CLOSED': Review.CLOSED,
'GO': Review.GO,
'GO_POST_HOC': Review.GO_POST_HOC,
'REVISION': Review.REVISION,

}
context['current_user_pk'] = self.request.user.pk

Expand Down
6 changes: 6 additions & 0 deletions reviews/templates/reviews/vue_templates/review_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ <h4>
{{ review.get_stage_display }}
{% endverbatim %}
</div>
<div class="ufl-undertitle-line" v-if="review.stage === context.review.CLOSED && review.continuation === context.review.REVISION">
{% trans "Reviewronde beëindigd: " %}
{% verbatim %}
{{ review.date_end | date("DD-MM-YYYY") }}
{% endverbatim %}
</div>
</template>


Expand Down
21 changes: 21 additions & 0 deletions reviews/utils/review_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, review, user):
DiscontinueReview(review, user),
SendConfirmation(review, user),
ChangeArchiveStatus(review, user),
ChangeDateStart(review, user),
]
self.ufl_actions = []

Expand Down Expand Up @@ -281,4 +282,24 @@ def description(self):
return _('Verberg aanvraag uit het archief')
else:
return _('Plaats aanvraag in het archief.')

class ChangeDateStart(ReviewAction):

def is_available(self):

user = self.user

user_groups = user.groups.values_list("name", flat=True)
if not settings.GROUP_SECRETARY in user_groups:
return False

return True

def action_url(self):

return reverse('proposals:update_date_start', args=(self.review.proposal.pk,))

def description(self):

return _('Startdatum wijzigen')