forked from extern/django-helpdesk
Merge pull request #894 from Benbb96/master
Improvements in Public part, to address issues with setting due date on a ticket, for #750
This commit is contained in:
commit
79d8046694
@ -173,9 +173,9 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
|||||||
)
|
)
|
||||||
|
|
||||||
due_date = forms.DateTimeField(
|
due_date = forms.DateTimeField(
|
||||||
widget=forms.TextInput(attrs={'class': 'form-control'}),
|
widget=forms.TextInput(attrs={'class': 'form-control', 'autocomplete': 'off'}),
|
||||||
required=False,
|
required=False,
|
||||||
input_formats=['%d/%m/%Y', '%m/%d/%Y', "%d.%m.%Y", ],
|
input_formats=['%d/%m/%Y', '%m/%d/%Y', "%d.%m.%Y"],
|
||||||
label=_('Due on'),
|
label=_('Due on'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -186,6 +186,9 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
|||||||
help_text=_('You can attach a file such as a document or screenshot to this ticket.'),
|
help_text=_('You can attach a file such as a document or screenshot to this ticket.'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Media:
|
||||||
|
js = ('helpdesk/js/init_due_date.js',)
|
||||||
|
|
||||||
def __init__(self, kbcategory=None, *args, **kwargs):
|
def __init__(self, kbcategory=None, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if kbcategory:
|
if kbcategory:
|
||||||
|
@ -61,8 +61,12 @@ table.table caption {
|
|||||||
table.ticket-stats caption {color: #fbff00; font-style: italic;}
|
table.ticket-stats caption {color: #fbff00; font-style: italic;}
|
||||||
table.ticket-stats tbody th, table.ticket-stats tbody tr {padding-left: 20px}
|
table.ticket-stats tbody th, table.ticket-stats tbody tr {padding-left: 20px}
|
||||||
|
|
||||||
.errorlist {list-style: none;}
|
.errorlist {
|
||||||
.errorlist {padding: 0;}
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
.has-error .input-group input, .has-error .input-group select, .has-error .input-group textarea {border-color: #b94a48}
|
.has-error .input-group input, .has-error .input-group select, .has-error .input-group textarea {border-color: #b94a48}
|
||||||
|
|
||||||
#helpdesk-nav-collapse #searchform {
|
#helpdesk-nav-collapse #searchform {
|
||||||
|
3
helpdesk/static/helpdesk/js/init_due_date.js
Normal file
3
helpdesk/static/helpdesk/js/init_due_date.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
$(() => {
|
||||||
|
$("#id_due_date").datepicker();
|
||||||
|
});
|
@ -3,30 +3,42 @@
|
|||||||
{% block helpdesk_title %}{% trans "Create Ticket" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "Create Ticket" %}{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_breadcrumb %}
|
{% block helpdesk_breadcrumb %}
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="#">{% trans "Tickets" %}</a>
|
<a href="#">{% trans "Tickets" %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active">{% trans "Create Ticket" %}</li>
|
<li class="breadcrumb-item active">{% trans "Create Ticket" %}</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_head %}
|
{% block helpdesk_head %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_body %}
|
{% block helpdesk_body %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card card-register mx-auto mt-5">
|
<div class="card card-register mx-auto mt-5">
|
||||||
<div class="card-header">{% trans "Submit a Ticket" %}</div>
|
<div class="card-header">{% trans "Submit a Ticket" %}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}</p>
|
<p>
|
||||||
<form method='post' action='./' enctype='multipart/form-data'>
|
{% trans "Unless otherwise stated, all fields are required." %}
|
||||||
|
{% trans "Please provide as descriptive a title and description as possible." %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if form.errors %}
|
||||||
|
{% include 'helpdesk/include/alert_form_errors.html' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form method='post' enctype='multipart/form-data'>
|
||||||
|
{% csrf_token %}
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{% if field.is_hidden %}
|
{% if field.is_hidden %}
|
||||||
{{ field }}
|
{{ field }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<!--<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required="required">-->
|
<label for='id_{{ field.name }}'>
|
||||||
<label for='id_{{ field.name }}'>{% trans field.label %}{% if not field.field.required %} ({% trans "Optional" %}){% endif %}</label>
|
{% trans field.label %}
|
||||||
|
{% if not field.field.required %}
|
||||||
|
({% trans "Optional" %})
|
||||||
|
{% endif %}
|
||||||
|
</label>
|
||||||
{{ field }}
|
{{ field }}
|
||||||
{% if field.errors %}
|
{% if field.errors %}
|
||||||
<small class='error'>{{ field.errors }}</small>
|
<small class='error'>{{ field.errors }}</small>
|
||||||
@ -37,8 +49,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<button type="submit" class="btn btn-primary btn-lg btn-block"><i class="fa fa-send"></i> {% trans "Submit Ticket" %}</button>
|
<button type="submit" class="btn btn-primary btn-lg btn-block">
|
||||||
{% csrf_token %}</form>
|
<i class="fa fa-send"></i> {% trans "Submit Ticket" %}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -46,22 +60,17 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_js %}
|
{% block helpdesk_js %}
|
||||||
<script type='text/javascript' language='javascript'>
|
{{ form.media.js }}
|
||||||
// this function listens for changes on any file input, and
|
<script>
|
||||||
// emits the appropriate event to update the input's text.
|
// this function listens for changes on any file input, and
|
||||||
// Needed to have properly styled file input buttons! (this really shouldn't be this hard...)
|
// emits the appropriate event to update the input's text.
|
||||||
$(document).on('change', ':file', function() {
|
// Needed to have properly styled file input buttons! (this really shouldn't be this hard...)
|
||||||
var input = $(this),
|
$(document).on('change', ':file', function () {
|
||||||
|
const input = $(this),
|
||||||
inputWidgetNum = $(this).attr('id').split("file")[1],
|
inputWidgetNum = $(this).attr('id').split("file")[1],
|
||||||
numFiles = input.get(0).files ? input.get(0).files.length : 1,
|
numFiles = input.get(0).files ? input.get(0).files.length : 1,
|
||||||
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||||
input.trigger('fileselect', [numFiles, label, inputWidgetNum]);
|
input.trigger('fileselect', [numFiles, label, inputWidgetNum]);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
|
||||||
$( function() {
|
|
||||||
$( "#id_due_date" ).datepicker();
|
|
||||||
} );
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||||
|
{% trans "There are errors in the form" %}.
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
@ -4,20 +4,23 @@
|
|||||||
{% block helpdesk_title %}{% trans "Create Ticket" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "Create Ticket" %}{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_breadcrumb %}
|
{% block helpdesk_breadcrumb %}
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="{% url 'helpdesk:home' %}">Public</a>
|
<a href="{% url 'helpdesk:home' %}">Public</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active">Create Ticket</li>
|
<li class="breadcrumb-item active">Create Ticket</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_body %}
|
{% block helpdesk_body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card card-register mx-auto mt-5">
|
<div class="card card-register mx-auto mt-5">
|
||||||
<div class="card-header">{% trans "Submit a Ticket" %}</div>
|
<div class="card-header">{% trans "Submit a Ticket" %}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% include 'helpdesk/public_create_ticket_base.html' %}
|
{% include 'helpdesk/public_create_ticket_base.html' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block helpdesk_js %}
|
||||||
|
{{ form.media.js }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,16 +1,24 @@
|
|||||||
{% load i18n bootstrap4form %}
|
{% load i18n bootstrap4form %}
|
||||||
{% load load_helpdesk_settings %}
|
{% load load_helpdesk_settings %}
|
||||||
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
|
||||||
|
|
||||||
{% if helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
|
{% with request|load_helpdesk_settings as helpdesk_settings %}
|
||||||
{% block form_header %}
|
{% if helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
|
||||||
<p>{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}</p>
|
<p>
|
||||||
{% endblock %}
|
{% trans "Unless otherwise stated, all fields are required." %}
|
||||||
<form method='post' enctype='multipart/form-data'>
|
{% trans "Please provide as descriptive a title and description as possible." %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if form.errors %}
|
||||||
|
{% include 'helpdesk/include/alert_form_errors.html' %}
|
||||||
|
{% endif %}
|
||||||
|
<form role="form" method='post' enctype='multipart/form-data'>
|
||||||
|
{% csrf_token %}
|
||||||
{{ form|bootstrap4form }}
|
{{ form|bootstrap4form }}
|
||||||
<button type="submit" class="btn btn-primary btn-lg btn-block"><i class="fa fa-send"></i> {% trans "Submit Ticket" %}</button>
|
<button type="submit" class="btn btn-primary btn-lg btn-block">
|
||||||
{% csrf_token %}</form>
|
{% trans "Submit Ticket" %} <i class="fa fa-paper-plane"></i>
|
||||||
{% else %}
|
</button>
|
||||||
<h2>{% trans "Public ticket submission is disabled. Please contact the administrator for assistance." %}</h2>
|
</form>
|
||||||
{% endif %}
|
{% else %}
|
||||||
|
<p>{% trans "Public ticket submission is disabled. Please contact the administrator for assistance." %}</p>
|
||||||
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
@ -4,101 +4,81 @@
|
|||||||
{% block helpdesk_title %}{% trans "Welcome to Helpdesk" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "Welcome to Helpdesk" %}{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_breadcrumb %}
|
{% block helpdesk_breadcrumb %}
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="#">Public</a>
|
<a href="#">Public</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active">Homepage</li>
|
<li class="breadcrumb-item active">Homepage</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_body %}
|
{% block helpdesk_body %}
|
||||||
|
<div class="container-fluid">
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
{% if kb_categories %}
|
||||||
{% if kb_categories %}
|
<div class="col-sm">
|
||||||
<div class="col-sm">
|
<h2>{% trans "Knowledgebase Articles" %}</h2>
|
||||||
<h2>{% trans "Knowledgebase Articles" %}</h2>
|
{% for category in kb_categories %}
|
||||||
{% for category in kb_categories %}
|
<div class="card" style="margin-top: 15px">
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">{{ category.title }}</h5>
|
<h5 class="card-title">{{ category.title }}</h5>
|
||||||
<p class="card-text">{{ category.description }}</p>
|
<p class="card-text">{{ category.description }}</p>
|
||||||
<p class="card-text"><small class="text-muted"><a href='{{ category.get_absolute_url }}'>{% trans 'View articles' %}<i class="fa fa-arrow-right"></i></a></small></p>
|
<p class="card-text">
|
||||||
|
<small class="text-muted">
|
||||||
|
<a href='{{ category.get_absolute_url }}'>
|
||||||
|
{% trans 'View articles' %} <i class="fa fa-arrow-right"></i>
|
||||||
|
</a>
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
|
|
||||||
<div class="col-sm">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
<h2 name='submit'>{% trans "Submit a Ticket" %}</h2>
|
|
||||||
<p>{% trans "Please provide as descriptive a title and description as possible." %}</p>
|
|
||||||
|
|
||||||
<form role="form" method='post' action='./#submit' enctype='multipart/form-data'>
|
|
||||||
<fieldset>
|
|
||||||
{{ form|bootstrap4form }}
|
|
||||||
{% comment %}
|
|
||||||
{% for field in form %}
|
|
||||||
|
|
||||||
{% if field.is_hidden %}
|
|
||||||
{{ field }}
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
|
||||||
<label class="control-label" for='id_{{ field.name }}'>{{ field.label }}</label>{% if not field.field.required %} <span class='form_optional'>{% trans "(Optional)" %}</span>{% endif %}</dt>
|
|
||||||
<div class="input-group">{{ field }}</div>
|
|
||||||
{% if field.errors %}<div class="help-block">{{ field.errors }}</div>{% endif %}
|
|
||||||
{% if field.help_text %}<span class='fhelp-block'>{{ field.help_text }}</span>{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
<div class="col-sm">
|
||||||
{% endcomment %}
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
<div class='buttons form-group'>
|
<h2>{% trans "Submit a Ticket" %}</h2>
|
||||||
<input type='submit' class="btn btn-primary" value='{% trans "Submit Ticket" %}' />
|
{% include 'helpdesk/public_create_ticket_base.html' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
{% csrf_token %}</form>
|
{% if not helpdesk_settings.HELPDESK_VIEW_A_TICKET_PUBLIC and not helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if not helpdesk_settings.HELPDESK_VIEW_A_TICKET_PUBLIC and not helpdesk_settings.HELPDESK_SUBMIT_A_TICKET_PUBLIC %}
|
|
||||||
<h2>{% trans "Please use button at upper right to login first." %}</h2>
|
<h2>{% trans "Please use button at upper right to login first." %}</h2>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if helpdesk_settings.HELPDESK_VIEW_A_TICKET_PUBLIC %}
|
{% if helpdesk_settings.HELPDESK_VIEW_A_TICKET_PUBLIC %}
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h2>{% trans "View a Ticket" %}</h2>
|
<h2>{% trans "View a Ticket" %}</h2>
|
||||||
|
|
||||||
<form method='get' action="{% url 'helpdesk:public_view' %}">
|
<form method='get' action="{% url 'helpdesk:public_view' %}">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||||
<label for='id_ticket'>{% trans "Ticket" %}</label>
|
<label for='id_ticket'>{% trans "Ticket" %}</label>
|
||||||
<div class="input-group"><input type='text' name='ticket' /></div>
|
<div class="input-group">
|
||||||
|
<input type='text' name='ticket' class='form-control'/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
<div class="form-group {% if field.errors %}has-error{% endif %}">
|
||||||
<label for='id_email'>{% trans "Your E-mail Address" %}</label>
|
<label for='id_email'>{% trans "Your E-mail Address" %}</label>
|
||||||
<div class="input-group"><input type='text' name='email' /></div>
|
<div class="input-group">
|
||||||
|
<input type='text' name='email' class='form-control'/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='buttons form-group'>
|
<div class='buttons form-group'>
|
||||||
<input type='submit' class="btn btn-primary" value='{% trans "View Ticket" %}' />
|
<input type='submit' class="btn btn-primary" value='{% trans "View Ticket" %}'/>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% csrf_token %}</form>
|
</form>
|
||||||
</div></div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block helpdesk_js %}
|
||||||
|
{{ form.media.js }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -15,6 +15,13 @@
|
|||||||
<td>{{ ticket.created|date:"r" }} ({{ ticket.created|naturaltime }})</td>
|
<td>{{ ticket.created|date:"r" }} ({{ ticket.created|naturaltime }})</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{% if ticket.due_date %}
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Due On" %}</th>
|
||||||
|
<td>{{ ticket.due_date|date:"r" }} ({{ ticket.due_date|naturaltime }})</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Submitter E-Mail" %}</th>
|
<th>{% trans "Submitter E-Mail" %}</th>
|
||||||
<td>{{ ticket.submitter_email }}</td>
|
<td>{{ ticket.submitter_email }}</td>
|
||||||
@ -26,10 +33,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for customfield in ticket.ticketcustomfieldvalue_set.all %}
|
{% for customfield in ticket.ticketcustomfieldvalue_set.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ customfield.field.label }}</th>
|
<th>{{ customfield.field.label }}</th>
|
||||||
<td>{{ customfield.value }}</td>
|
<td>{{ customfield.value|default:"" }}</td>
|
||||||
</tr>{% endfor %}
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% if tags_enabled %}
|
{% if tags_enabled %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -137,6 +137,12 @@ class SuccessIframeView(TemplateView):
|
|||||||
class CreateTicketView(BaseCreateTicketView):
|
class CreateTicketView(BaseCreateTicketView):
|
||||||
template_name = 'helpdesk/public_create_ticket.html'
|
template_name = 'helpdesk/public_create_ticket.html'
|
||||||
|
|
||||||
|
def get_form(self, form_class=None):
|
||||||
|
form = super().get_form(form_class)
|
||||||
|
# Add the CSS error class to the form in order to better see them in the page
|
||||||
|
form.error_css_class = 'text-danger'
|
||||||
|
return form
|
||||||
|
|
||||||
|
|
||||||
class Homepage(CreateTicketView):
|
class Homepage(CreateTicketView):
|
||||||
template_name = 'helpdesk/public_homepage.html'
|
template_name = 'helpdesk/public_homepage.html'
|
||||||
|
Loading…
Reference in New Issue
Block a user