def render_filter(self):
        filter_widgets = ""

        # vendor areas of current user
        vendors = vendors_form_vocab()
        vendor_selector = None
        # vendor selection, include if more than one vendor
        if len(vendors) > 2:
            vendor_selector = factory(
                'div:label:select',
                name='vendor',
                value=self.request.form.get('vendor', ''),
                props={
                    'vocabulary': vendors,
                    'label': _('filter_for_vendors',
                               default=u'Filter for vendors'),
                }
            )
            filter_widgets += vendor_selector(request=self.request)

        # customers of current user
        customers = customers_form_vocab()
        customer_selector = None
        # customers selection, include if more than one customer
        if len(customers) > 2:
            customer_selector = factory(
                'div:label:select',
                name='customer',
                value=self.request.form.get('customer', ''),
                props={
                    'vocabulary': customers,
                    'label': _('filter_for_customers',
                               default=u'Filter for customers'),
                }
            )
            filter_widgets += customer_selector(request=self.request)

        states = states_form_vocab()
        state_selector = factory(
            'div:label:select',
            name='state',
            value=self.request.form.get('state', ''),
            props={
                'vocabulary': states,
                'label': _('filter_for_state',
                           default=u'Filter for states'),
            }
        )
        filter_widgets += state_selector(request=self.request)

        salaried = salaried_form_vocab()
        salaried_selector = factory(
            'div:label:select',
            name='salaried',
            value=self.request.form.get('salaried', ''),
            props={
                'vocabulary': salaried,
                'label': _('filter_for_salaried',
                           default=u'Filter for salaried state'),
            }
        )
        filter_widgets += salaried_selector(request=self.request)

        # From date filter.
        from_date = factory(
            'div:label:text',
            name='from_date',
            value=self.request.form.get('from_date', ''),
            props={
                'div.class': 'date_from_filter',
                'label': _('filter_from_date',
                           default=u'Filter from date'),
            }
        )
        filter_widgets += from_date(request=self.request)

        # To date filter.
        to_date = factory(
            'div:label:text',
            name='to_date',
            value=self.request.form.get('to_date', ''),
            props={
                'div.class': 'date_to_filter',
                'label': _('filter_to_date',
                           default=u'Filter to date'),
            }
        )
        filter_widgets += to_date(request=self.request)

        # group orders
        groups = vocabs.groups_vocab()
        group_selector = factory(
            'div:label:select',
            name='group_by',
            value=self.request.form.get('group_by', 'buyable'),
            props={
                'div.class': 'group_filter',
                'vocabulary': groups,
                'label': _('group_orders_by',
                           default=u'Group orders by'),
            }
        )
        filter_widgets += group_selector(request=self.request)

        return filter_widgets
Example #2
0
 def vendor_mode(self):
     return len(vendors_form_vocab()) > 2 and 'edit' or 'skip'
Example #3
0
 def vendor_vocabulary(self):
     return vendors_form_vocab()
Example #4
0
 def vendor_mode(self):
     return len(vendors_form_vocab()) > 2 and 'edit' or 'skip'
Example #5
0
 def vendor_vocabulary(self):
     return vendors_form_vocab()
Example #6
0
    def render_filter(self):
        filter_widgets = ""

        # vendor areas of current user
        vendors = vendors_form_vocab()
        vendor_selector = None
        # vendor selection, include if more than one vendor
        if len(vendors) > 2:
            vendor_selector = factory(
                'div:label:select',
                name='vendor',
                value=self.request.form.get('vendor', ''),
                props={
                    'vocabulary': vendors,
                    'label': _('filter_for_vendors',
                               default=u'Filter for vendors'),
                }
            )
            filter_widgets += vendor_selector(request=self.request)

        # customers of current user
        customers = customers_form_vocab()
        customer_selector = None
        # customers selection, include if more than one customer
        if len(customers) > 2:
            customer_selector = factory(
                'div:label:select',
                name='customer',
                value=self.request.form.get('customer', ''),
                props={
                    'vocabulary': customers,
                    'label': _('filter_for_customers',
                               default=u'Filter for customers'),
                }
            )
            filter_widgets += customer_selector(request=self.request)

        states = states_form_vocab()
        state_selector = factory(
            'div:label:select',
            name='state',
            value=self.request.form.get('state', ''),
            props={
                'vocabulary': states,
                'label': _('filter_for_state',
                           default=u'Filter for states'),
            }
        )
        filter_widgets += state_selector(request=self.request)

        salaried = salaried_form_vocab()
        salaried_selector = factory(
            'div:label:select',
            name='salaried',
            value=self.request.form.get('salaried', ''),
            props={
                'vocabulary': salaried,
                'label': _('filter_for_salaried',
                           default=u'Filter for salaried state'),
            }
        )
        filter_widgets += salaried_selector(request=self.request)

        # From date filter.
        from_date = factory(
            'div:label:text',
            name='from_date',
            value=self.request.form.get('from_date', ''),
            props={
                'div.class': 'date_from_filter',
                'label': _('filter_from_date',
                           default=u'Filter from date'),
            }
        )
        filter_widgets += from_date(request=self.request)

        # To date filter.
        to_date = factory(
            'div:label:text',
            name='to_date',
            value=self.request.form.get('to_date', ''),
            props={
                'div.class': 'date_to_filter',
                'label': _('filter_to_date',
                           default=u'Filter to date'),
            }
        )
        filter_widgets += to_date(request=self.request)

        # group orders
        groups = vocabs.groups_vocab()
        group_selector = factory(
            'div:label:select',
            name='group_by',
            value=self.request.form.get('group_by', 'buyable'),
            props={
                'div.class': 'group_filter',
                'vocabulary': groups,
                'label': _('group_orders_by',
                           default=u'Group orders by'),
            }
        )
        filter_widgets += group_selector(request=self.request)

        return filter_widgets