diff --git a/helpdesk/forms.py b/helpdesk/forms.py index b9a00ee3..f1496ccb 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -606,6 +606,22 @@ class MultipleTicketSelectForm(forms.Form): return tickets +class ChecklistTemplateForm(forms.ModelForm): + name = forms.CharField( + widget=forms.TextInput(attrs={'class': 'form-control'}), + required=True, + ) + task_list = forms.JSONField(widget=forms.HiddenInput()) + + class Meta: + model = ChecklistTemplate + fields = ('name', 'task_list') + + def clean_task_list(self): + task_list = self.cleaned_data['task_list'] + return list(map(lambda task: task.strip(), task_list)) + + class ChecklistForm(forms.ModelForm): name = forms.CharField( widget=forms.TextInput(attrs={'class': 'form-control'}), diff --git a/helpdesk/models.py b/helpdesk/models.py index 7f9e2072..c2e90bb6 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -2010,7 +2010,7 @@ def is_a_list_without_empty_element(task_list): for task in task_list: if not isinstance(task, str): raise ValidationError(f'{task} is not a string') - if task == '': + if task.strip() == '': raise ValidationError('A task cannot be an empty string') diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index cdd6f2f0..f36f08d9 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -102,3 +102,7 @@ table .tickettitle { overflow: hidden; text-overflow: ellipsis; } + +.handle { + cursor: grab; +} diff --git a/helpdesk/templates/helpdesk/checklist_template_confirm_delete.html b/helpdesk/templates/helpdesk/checklist_template_confirm_delete.html new file mode 100644 index 00000000..d1da22bb --- /dev/null +++ b/helpdesk/templates/helpdesk/checklist_template_confirm_delete.html @@ -0,0 +1,47 @@ +{% extends "helpdesk/base.html" %} + +{% load i18n %} + +{% block helpdesk_title %}{% trans "Delete Checklist Template" %}{% endblock %} + +{% block helpdesk_breadcrumb %} + + + +{% endblock %} + +{% block helpdesk_body %} +
+
+
+
+

+ {% trans "Delete Checklist Template" %} +

+
+
+
+ {% csrf_token %} +

{% trans "Are you sure your want to delete checklist template" %} {{ checklist_template.name }} ?

+
+ + + {% trans "Don't Delete" %} + + +
+
+
+
+
+
+{% endblock %} diff --git a/helpdesk/templates/helpdesk/checklist_templates.html b/helpdesk/templates/helpdesk/checklist_templates.html new file mode 100644 index 00000000..30db0975 --- /dev/null +++ b/helpdesk/templates/helpdesk/checklist_templates.html @@ -0,0 +1,119 @@ +{% extends "helpdesk/base.html" %} + +{% load i18n %} + +{% block helpdesk_title %}{% trans "Checklist Templates" %}{% endblock %} + +{% block helpdesk_breadcrumb %} + + +{% endblock %} + +{% block helpdesk_body %} +

{% trans "Maintain checklist templates" %}

+
+
+
+
+ {% if checklist_template %} + {% trans "Edit checklist template" %} + {% else %} + {% trans "Create new checklist template" %} + {% endif %} +
+
+
+ {% csrf_token %} + {{ form.as_p }} + + + + + + + + + + {% if checklist_template %} + {% for value in checklist_template.task_list %} + {% include 'helpdesk/include/task_form_row.html' %} + {% endfor %} + {% else %} + {% include 'helpdesk/include/task_form_row.html' %} + {% endif %} + +
TaskActions
+ +
+ +
+
+
+
+
+ {% for checklist in checklists %} +
+ + {{ checklist.name }} + {% if checklist_template.id != checklist.id %} + + + + {% endif %} + + + + + {{ checklist.task_list|length }} tasks +
+ {% endfor %} +
+
+
+{% endblock %} + +{% block helpdesk_js %} + + + +{% endblock %} \ No newline at end of file diff --git a/helpdesk/templates/helpdesk/email_ignore_list.html b/helpdesk/templates/helpdesk/email_ignore_list.html index 3dda68b7..ad03e8b1 100644 --- a/helpdesk/templates/helpdesk/email_ignore_list.html +++ b/helpdesk/templates/helpdesk/email_ignore_list.html @@ -2,6 +2,13 @@ {% block helpdesk_title %}{% trans "Ignored E-Mail Addresses" %}{% endblock %} +{% block helpdesk_breadcrumb %} + + +{% endblock %} + {% block helpdesk_body %}{% blocktrans %}

Ignored E-Mail Addresses

diff --git a/helpdesk/templates/helpdesk/include/task_form_row.html b/helpdesk/templates/helpdesk/include/task_form_row.html new file mode 100644 index 00000000..77a3af75 --- /dev/null +++ b/helpdesk/templates/helpdesk/include/task_form_row.html @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/helpdesk/templates/helpdesk/system_settings.html b/helpdesk/templates/helpdesk/system_settings.html index ad41f2b6..b09f86bd 100644 --- a/helpdesk/templates/helpdesk/system_settings.html +++ b/helpdesk/templates/helpdesk/system_settings.html @@ -18,6 +18,7 @@