Commit 2846f023d095d7740dd87a98ba03b1f771d531bf

Authored by fbormann
1 parent da7a4c8a

modified some css and added init and end date checking

amadeus/static/css/base/amadeus.css
... ... @@ -1227,6 +1227,22 @@ div.dataTables_wrapper div.dataTables_paginate {
1227 1227 display: inline;
1228 1228 margin-right: 30px;
1229 1229 }
  1230 +
  1231 +.delete-row{
  1232 + float: right;
  1233 + background-color: gray;
  1234 + color: white;
  1235 + padding: 5px 20px;
  1236 + font-size: 12px;
  1237 + text-decoration: none;
  1238 + border: none;
  1239 + border-radius: 2px;
  1240 + position: relative;
  1241 + margin: 10px 20px;
  1242 + font-weight: 700;
  1243 + text-transform: uppercase;
  1244 + letter-spacing: 0;
  1245 +}
1230 1246 /* End Reports */
1231 1247  
1232 1248 /* Chat */
... ...
reports/forms.py
... ... @@ -6,7 +6,7 @@ from django.forms.formsets import BaseFormSet
6 6  
7 7 class ResourceAndTagForm(forms.Form):
8 8  
9   - resource = forms.ChoiceField(label=_("Resources"), required=True)
  9 + resource = forms.ChoiceField(label=_("Kind Of Resource"), required=True)
10 10 tag = forms.ChoiceField(label=_('Tag'), required=True)
11 11  
12 12 def __init__(self, *args, **kwargs):
... ... @@ -37,15 +37,22 @@ class CreateInteractionReportForm(forms.Form):
37 37 self.fields['topic'].choices.append((_("All"), _("All")))
38 38  
39 39  
  40 + def clean(self):
  41 + cleaned_data = super(CreateInteractionReportForm, self).clean()
  42 + init_date = cleaned_data.get("init_date")
  43 + end_date = cleaned_data.get("end_date")
  44 + if init_date and end_date:
  45 + if init_date > end_date:
  46 + raise forms.ValidationError(_("The initial date can't be after the end one."))
40 47  
41 48 def clean_init_date(self):
42   - init_date = self.cleaned_data.get('init_date')
  49 + init_date = self.cleaned_data['init_date']
43 50 if init_date < self.subject.init_date:
44 51 self._errors['init_date'] = [_('This date should be right or after ' + str(self.subject.init_date) + ', which is when the subject started. ')]
45 52 return init_date
46 53  
47 54 def clean_end_date(self):
48   - end_date = self.cleaned_data.get('init_date')
  55 + end_date = self.cleaned_data['end_date']
49 56 if end_date > self.subject.end_date:
50 57 self._errors['end_date'] = [_('This date should be right or before ' + str(self.subject.end_date) + ', which is when the subject finishes. ')]
51 58 return end_date
52 59 \ No newline at end of file
... ...
reports/templates/reports/_form.html
... ... @@ -2,7 +2,21 @@
2 2  
3 3 <form action="" method="post">{% csrf_token %}
4 4 <p>{% trans "General Parameters" %}</p><hr>
  5 + {% if form.errors %}
  6 + <div class="alert alert-danger alert-dismissible" role="alert">
  7 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  8 + <span aria-hidden="true">&times;</span>
  9 + </button>
  10 + <ul>
  11 + {% for key, message in form.errors.items %}
  12 + <li>{{message}}</li>
  13 + {% endfor %}
  14 + </ul>
  15 + </div>
  16 + {% endif %}
5 17 {% for field in form %}
  18 +
  19 +
6 20 {% if field.auto_id == 'id_init_date' or field.auto_id == 'id_end_date' %}
7 21 <label> {{field.label}} </label>
8 22 {% render_field field class='form-control date-picker' %}
... ...