Various view tweaks

This commit is contained in:
Lance Edgar 2017-08-04 11:55:53 -05:00
parent 97fb74f093
commit dce0efb5fa
3 changed files with 12 additions and 2 deletions

View file

@ -130,6 +130,8 @@ class CustomersView(MasterView):
fs.email_preference.set(renderer=forms.EnumFieldRenderer(self.enum.EMAIL_PREFERENCE)) fs.email_preference.set(renderer=forms.EnumFieldRenderer(self.enum.EMAIL_PREFERENCE))
fs.append(forms.AssociationProxyField('people', renderer=forms.renderers.PeopleFieldRenderer, fs.append(forms.AssociationProxyField('people', renderer=forms.renderers.PeopleFieldRenderer,
readonly=True)) readonly=True))
fs.active_in_pos.set(label="Active in POS")
fs.active_in_pos_sticky.set(label="Always Active in POS")
def configure_fieldset(self, fs): def configure_fieldset(self, fs):
fs.configure( fs.configure(
@ -142,6 +144,8 @@ class CustomersView(MasterView):
fs.default_email, fs.default_email,
fs.email_preference, fs.email_preference,
fs.people, fs.people,
fs.active_in_pos,
fs.active_in_pos_sticky,
]) ])
def configure_mobile_fieldset(self, fs): def configure_mobile_fieldset(self, fs):

View file

@ -60,6 +60,7 @@ class DataSyncChangesView(MasterView):
def configure_grid(self, g): def configure_grid(self, g):
super(DataSyncChangesView, self).configure_grid(g) super(DataSyncChangesView, self).configure_grid(g)
g.default_sortkey = 'obtained' g.default_sortkey = 'obtained'
g.set_type('obtained', 'datetime')
def restart(self): def restart(self):
# TODO: Add better validation (e.g. CSRF) here? # TODO: Add better validation (e.g. CSRF) here?

View file

@ -26,6 +26,7 @@ Person Views
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
import six
import sqlalchemy as sa import sqlalchemy as sa
import formalchemy as fa import formalchemy as fa
@ -48,8 +49,12 @@ class CustomersFieldRenderer(fa.FieldRenderer):
items = [] items = []
for customer in customers: for customer in customers:
customer = customer.customer customer = customer.customer
items.append(HTML.tag('li', c=tags.link_to('{} {}'.format(customer.id, customer), text = six.text_type(customer)
self.request.route_url('customers.view', uuid=customer.uuid)))) if customer.id:
text = "({}) {}".format(customer.id, text)
elif customer.number:
text = "({}) {}".format(customer.number, text)
items.append(HTML.tag('li', c=tags.link_to(text, self.request.route_url('customers.view', uuid=customer.uuid))))
return HTML.tag('ul', c=items) return HTML.tag('ul', c=items)