aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2021-05-24 17:03:06 +0300
committerFilipp Lepalaan <filipp@mac.com>2021-05-24 17:03:06 +0300
commit467f9fef717cbdc217aae63fef6481150e8e34a7 (patch)
treee738ef41beb2a4a441188a2cb5a202c8df25fa77
parentd2394e47e6baed4f878103477862d1bcc27b816a (diff)
downloadServo-467f9fef717cbdc217aae63fef6481150e8e34a7.tar.gz
Servo-467f9fef717cbdc217aae63fef6481150e8e34a7.tar.bz2
Servo-467f9fef717cbdc217aae63fef6481150e8e34a7.zip
Checkin fixes
-rw-r--r--servo/forms/base.py2
-rw-r--r--servo/forms/checkin.py11
-rw-r--r--servo/templates/checkin/newindex.html2
-rwxr-xr-xservo/templates/default.html4
-rw-r--r--servo/views/checkin.py18
5 files changed, 23 insertions, 14 deletions
diff --git a/servo/forms/base.py b/servo/forms/base.py
index b59215b..9467de5 100644
--- a/servo/forms/base.py
+++ b/servo/forms/base.py
@@ -72,7 +72,7 @@ class BaseModelForm(forms.ModelForm):
class SearchFieldInput(forms.TextInput):
- def render(self, name, value, attrs=None):
+ def render(self, name, value, attrs=None, **kwargs):
field = super(SearchFieldInput, self).render(name, value, attrs)
final_attrs = self.build_attrs(attrs)
diff --git a/servo/forms/checkin.py b/servo/forms/checkin.py
index c8429a9..6a6cf9d 100644
--- a/servo/forms/checkin.py
+++ b/servo/forms/checkin.py
@@ -40,6 +40,7 @@ class ConfirmationForm(forms.Form):
class DeviceForm(forms.ModelForm):
+ """The form for editing devices in the /checkin view"""
required_css_class = 'required'
@@ -69,10 +70,12 @@ class DeviceForm(forms.ModelForm):
help_text=_("Please describe the condition of the device")
)
- queue = forms.ModelChoiceField(label=_('Queue'),
- required=False,
- queryset=Queue.objects.all(),
- help_text=_('Assign order to this queue'))
+ queue = forms.ModelChoiceField(
+ label=_('Queue'),
+ required=False,
+ queryset=Queue.objects.all(),
+ help_text=_('Assign order to this queue')
+ )
class Meta:
model = Device
diff --git a/servo/templates/checkin/newindex.html b/servo/templates/checkin/newindex.html
index 96c8042..f1fc035 100644
--- a/servo/templates/checkin/newindex.html
+++ b/servo/templates/checkin/newindex.html
@@ -99,6 +99,7 @@
{% bootstrap_field device_form.condition %}
</div>
<div class="col-md-6">
+ {% if questions %}
{% bootstrap_field device_form.pop %}
<table class="table">
<thead>
@@ -121,6 +122,7 @@
{% endfor %}
</tbody>
</table>
+ {% endif %}
{% bootstrap_field customer_form.checkin_location %}
{% bootstrap_field customer_form.checkout_location %}
{% if request.user.is_authenticated %}
diff --git a/servo/templates/default.html b/servo/templates/default.html
index de363f4..15de430 100755
--- a/servo/templates/default.html
+++ b/servo/templates/default.html
@@ -72,7 +72,11 @@
<li><a href="{% url 'admin-settings' %}"><i class="icon-cog"></i> {% trans "System Settings" %}</a></li>
{% endif %}
<li class="divider"></li>
+ {% if show_checkin %}
<li><a href="{% url 'checkin-index' %}"><i class="icon-check"></i> {% trans "Go to check-in" %}</a></li>
+ {% else %}
+ <li class="disabled"><a href="#"><i class="icon-check"></i> {% trans "Go to check-in" %}</a></li>
+ {% endif %}
<li><a href="{% url 'accounts-logout' %}" data-modal="#modal"><i class="icon-off"></i> {% trans "Log out" %}...</a></li>
</ul>
{% endwith %}
diff --git a/servo/views/checkin.py b/servo/views/checkin.py
index 0c83201..513625b 100644
--- a/servo/views/checkin.py
+++ b/servo/views/checkin.py
@@ -138,7 +138,7 @@ def init_session(request):
if not request.session.get('company_name'):
request.session['company_name'] = Configuration.conf('company_name')
- if request.user.is_authenticated():
+ if request.user.is_authenticated:
# these are our fallback defaults
user = request.user
@@ -193,7 +193,7 @@ def thanks(request, order):
def get_customer(request):
"""Return the selected customer data."""
- if not request.user.is_authenticated():
+ if not request.user.is_authenticated:
raise PermissionDenied
if not request.GET.get('c'):
@@ -267,13 +267,13 @@ def index(request):
title = _('Service Order Check-In')
dcat = request.GET.get('d', 'mac')
dmap = {
- 'mac': _('Mac'),
- 'iphone': _('iPhone'),
- 'ipad': _('iPad'),
- 'ipod': _('iPod'),
- 'acc': _('Apple Accessory'),
- 'beats': _('Beats Products'),
- 'other': _('Other Devices'),
+ 'mac' : _('Mac'),
+ 'iphone' : _('iPhone'),
+ 'ipad' : _('iPad'),
+ 'ipod' : _('iPod'),
+ 'acc' : _('Apple Accessory'),
+ 'beats' : _('Beats Products'),
+ 'other' : _('Other Devices'),
}
issue_form = forms.IssueForm()