Ejemplo n.º 1
0
    def __init__(self, context, request):
        super(ClientFolderContentsView, self).__init__(context, request)

        self.title = self.context.translate(_("Clients"))
        self.description = ""
        self.form_id = "list_clientsfolder"
        self.sort_on = "sortable_title"
        # Landing page to be added to the link of each client from the list
        self.landing_page = get_registry_value(self._LANDING_PAGE_REGISTRY_KEY,
                                               self._DEFAULT_LANDING_PAGE)

        self.contentFilter = {
            "portal_type": "Client",
            "sort_on": "sortable_title",
            "sort_order": "ascending"
        }

        self.show_select_row = False
        self.show_select_all_checkbox = False
        self.show_select_column = False
        self.pagesize = 25
        self.icon = "{}/{}".format(
            self.portal_url, "++resource++bika.lims.images/client_big.png")
        request.set("disable_border", 1)

        self.columns = collections.OrderedDict((
            (
                "title",
                {
                    "title": _("Name"),
                    "index": "sortable_title"
                },
            ),
            ("getClientID", {
                "title": _("Client ID")
            }),
            ("EmailAddress", {
                "title": _("Email Address"),
                "sortable": False
            }),
            ("getCountry", {
                "toggle": False,
                "sortable": False,
                "title": _("Country")
            }),
            ("getProvince", {
                "toggle": False,
                "sortable": False,
                "title": _("Province")
            }),
            ("getDistrict", {
                "toggle": False,
                "sortable": False,
                "title": _("District")
            }),
            ("Phone", {
                "title": _("Phone"),
                "sortable": False
            }),
            ("Fax", {
                "toggle": False,
                "sortable": False,
                "title": _("Fax")
            }),
            ("BulkDiscount", {
                "toggle": False,
                "sortable": False,
                "title": _("Bulk Discount")
            }),
            ("MemberDiscountApplies", {
                "toggle": False,
                "sortable": False,
                "title": _("Member Discount")
            }),
        ))

        self.review_states = [
            {
                "id": "default",
                "contentFilter": {
                    "review_state": "active"
                },
                "title": _("Active"),
                "transitions": [
                    {
                        "id": "deactivate"
                    },
                ],
                "columns": self.columns.keys(),
            },
            {
                "id": "inactive",
                "title": _("Inactive"),
                "contentFilter": {
                    "review_state": "inactive"
                },
                "transitions": [
                    {
                        "id": "activate"
                    },
                ],
                "columns": self.columns.keys(),
            },
            {
                "id": "all",
                "title": _("All"),
                "contentFilter": {},
                "transitions": [],
                "columns": self.columns.keys(),
            },
        ]
Ejemplo n.º 2
0
    def __init__(self, context, request):
        super(ClientFolderContentsView, self).__init__(context, request)

        self.title = self.context.translate(_("Clients"))
        self.description = ""
        self.form_id = "list_clientsfolder"
        self.sort_on = "sortable_title"
        # Landing page to be added to the link of each client from the list
        self.landing_page = get_registry_value(self._LANDING_PAGE_REGISTRY_KEY,
                                               self._DEFAULT_LANDING_PAGE)
        self.contentFilter = {'portal_type': 'Client',
                              'sort_on': 'sortable_title',
                              'sort_order': 'ascending'}

        self.filter_indexes = ['title', 'SearchableText']

        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_all_checkbox = False
        self.show_select_column = False
        self.pagesize = 25
        self.icon = '{}/{}'.\
            format(self.portal_url,
            "++resource++bika.lims.images/client_big.png")
        request.set('disable_border', 1)

        self.columns = {
            'title': {'title': _('Name'), 'index': 'sortable_title'},
            'EmailAddress': {'title': _('Email Address')},
            'getCountry': {'title': _('Country')},
            'getProvince': {'title': _('Province')},
            'getDistrict': {'title': _('District')},
            'Phone': {'title': _('Phone')},
            'Fax': {'title': _('Fax')},
            'ClientID': {'title': _('Client ID')},
            'BulkDiscount': {'title': _('Bulk Discount')},
            'MemberDiscountApplies': {'title': _('Member Discount')},
        }

        self.review_states = [  # leave these titles and ids alone
            {'id': 'default',
             'contentFilter': {'inactive_state': 'active'},
             'title': _('Active'),
             'transitions': [{'id': 'deactivate'}, ],
             'columns': ['title',
                         'ClientID',
                         'getCountry',
                         'getProvince',
                         'getDistrict',
                         'EmailAddress',
                         'Phone',
                         'Fax', ]
             },
            {'id': 'inactive',
             'title': _('Dormant'),
             'contentFilter': {'inactive_state': 'inactive'},
             'transitions': [{'id': 'activate'}, ],
             'columns': ['title',
                         'ClientID',
                         'getCountry',
                         'getProvince',
                         'getDistrict',
                         'EmailAddress',
                         'Phone',
                         'Fax', ]
             },
            {'id': 'all',
             'title': _('All'),
             'contentFilter': {},
             'transitions': [],
             'columns': ['title',
                         'ClientID',
                         'getCountry',
                         'getProvince',
                         'getDistrict',
                         'EmailAddress',
                         'Phone',
                         'Fax', ]
             },
        ]