Skip to content

Commit

Permalink
Merge pull request #120 from gaiaresources/dash_refactor
Browse files Browse the repository at this point in the history
Dash refactor
  • Loading branch information
tony-gaia committed Oct 20, 2016
2 parents bdf0b23 + 992a8ec commit ac610d0
Show file tree
Hide file tree
Showing 13 changed files with 1,075 additions and 258 deletions.
84 changes: 81 additions & 3 deletions wildlifelicensing/apps/customer_management/views/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from django.core.urlresolvers import reverse

from wildlifelicensing.apps.dashboard.views import base
from wildlifelicensing.apps.dashboard.views.officer import TablesApplicationsOfficerView, TablesLicencesOfficerView, \
TablesReturnsOfficerView
from wildlifelicensing.apps.main.mixins import OfficerRequiredMixin
from wildlifelicensing.apps.main.signals import identification_uploaded
from wildlifelicensing.apps.customer_management.forms import CustomerDetailsForm
Expand All @@ -13,17 +15,18 @@
from wildlifelicensing.apps.main.forms import CommunicationsLogEntryForm


class CustomerLookupView(OfficerRequiredMixin, base.TableBaseView):
class CustomerLookupView(TablesApplicationsOfficerView, TablesLicencesOfficerView, TablesReturnsOfficerView):
template_name = 'wl/customer_lookup.html'
login_url = '/'


def _build_data(self):
data = super(CustomerLookupView, self)._build_data()

# applications
data['applications']['columnDefinitions'] = [
{
'title': 'Lodge Number'
'title': 'Lodgement Number'
},
{
'title': 'Licence Type'
Expand Down Expand Up @@ -109,7 +112,7 @@ def _build_data(self):
# returns
data['returns']['columnDefinitions'] = [
{
'title': 'Lodge Number'
'title': 'Lodgement Number'
},
{
'title': 'Licence Type'
Expand Down Expand Up @@ -144,6 +147,81 @@ def _build_data(self):

return data

#########################
# Applications
#########################
@property
def applications_table_options(self):
result = super(CustomerLookupView, self).applications_table_options
result.update({
'pageLength': 10,
})
return result

@property
def applications_data_url(self):
return reverse('wl_customer_management:data_applications', args=self.args)

@property
def applications_filters(self):
# no filters
return {}

@property
def get_applications_session_data(self):
# no session
return {}

#########################
# Licences
#########################
@property
def licences_table_options(self):
result = super(CustomerLookupView, self).licences_table_options
result.update({
'pageLength': 10,
})
return result

@property
def licences_data_url(self):
return reverse('wl_customer_management:data_licences', args=self.args)

@property
def licences_filters(self):
# no filters
return {}

@property
def get_licences_session_data(self):
# no session
return {}

#########################
# Returns
#########################
@property
def returns_table_options(self):
result = super(CustomerLookupView, self).returns_table_options
result.update({
'pageLength': 10,
})
return result

@property
def returns_data_url(self):
return reverse('wl_customer_management:data_returns', args=self.args)

@property
def returns_filters(self):
# no filters
return {}

@property
def get_returns_session_data(self):
# no session
return {}

def get(self, request, *args, **kwargs):
if 'customer' in self.request.GET:
customer = get_object_or_404(EmailUser, pk=self.request.GET.get('customer'))
Expand Down
Loading

0 comments on commit ac610d0

Please sign in to comment.