Beispiel #1
0
def mailings_tab(request):
    from django.apps import apps

    if apps.is_installed("basxconnect.mailer_integration"):
        from basxconnect.mailer_integration.layouts import mailer_integration_tile

        mailer_tile = mailer_integration_tile(request)
    else:
        mailer_tile = tiling_col()

    return layout.tabs.Tab(
        _("Mailings"),
        grid_inside_tab(
            R(
                tile_col_edit_modal(
                    _("Settings"),
                    models.NaturalPerson,
                    "ajax_edit_mailings",
                    Icon("settings--adjust"),
                    [
                        "preferred_language",
                        "type",
                        "salutation_letter",
                        "gender",
                        "form_of_address",
                    ],
                ),
                mailer_tile,
            ), ),
    )
def relationshipstab(request):
    person = get_object_or_404(Person, pk=request.resolver_match.kwargs["pk"])
    modal_from = modal_add_relationship_from(person)
    modal_to = modal_add_relationship_to(person)
    return layout.tabs.Tab(
        _("Relationships"),
        utils.grid_inside_tab(
            R(
                utils.tiling_col(
                    relationships_datatable(
                        request,
                        title=_("Relationships to person"),
                        queryset=hg.F(
                            lambda c: c["object"].relationships_from.all()),
                        primary_button=button_add_relationship_to(modal_to),
                    ),
                    modal_to,
                    hg.DIV(style="margin-top: 4rem;"),
                    relationships_datatable(
                        request,
                        title=_("Relationships from person"),
                        queryset=hg.F(
                            lambda c: c["object"].relationships_to.all()),
                        primary_button=button_add_relationship_from(
                            modal_from),
                    ),
                    modal_from,
                )), ),
    )
def contributions_tab(request):
    person = get_object_or_404(Person, pk=request.resolver_match.kwargs["pk"])
    return layout.tabs.Tab(
        _("Contributions"),
        utils.grid_inside_tab(
            R(
                utils.tiling_col(
                    layout.datatable.DataTable.from_queryset(
                        person.contributions.all(),
                        columns=[
                            "_import.date",
                            "date",
                            "note",
                            "debitaccount",
                            "creditaccount",
                            "amount_formatted",
                        ],
                        title="",
                        primary_button=layout.button.Button.from_link(
                            Link(
                                href=ModelHref(Contribution,
                                               "add",
                                               query={"person": person.id}),
                                label=_("Add %s") %
                                pretty_modelname(Contribution),
                            ),
                            icon=layout.icon.Icon("add", size=20),
                        ),
                        backurl=request.get_full_path(),
                        prevent_automatic_sortingnames=True,
                    )))),
    )
def base_data_tab(request):

    return layout.tabs.Tab(
        _("Personal data"),
        utils.grid_inside_tab(
            R(
                personal_data(),
                person_metadata(models.NaturalPerson),
            ),
            base_data.common_tiles(request),
        ),
    )
Beispiel #5
0
def mailings_tab(request):

    from django.apps import apps

    if apps.is_installed("basxconnect.mailer_integration"):
        from basxconnect.mailer_integration.layouts import mailer_integration_tile

        mailer_tile = mailer_integration_tile(request)
    else:
        mailer_tile = tiling_col()

    return layout.tabs.Tab(
        _("Mailings"),
        grid_inside_tab(R(
            mailer_tile,
            tiling_col(),
        ), ),
    )
def base_data_tab(request):
    return layout.tabs.Tab(
        _("Base data"),
        grid_inside_tab(
            R(
                tile_col_edit_modal(
                    _("Base Data"),
                    models.PersonAssociation,
                    "ajax_edit",
                    Icon("building"),
                    [
                        "name",
                        "preferred_language",
                        "salutation_letter",
                    ],
                ),
                person_metadata(models.PersonAssociation),
            ),
            base_data.common_tiles(request),
        ),
    )
def base_data_tab(request):
    return layout.tabs.Tab(
        _("Base data"),
        hg.BaseElement(
            grid_inside_tab(
                R(
                    tile_col_edit_modal(
                        _("Base Data"),
                        models.LegalPerson,
                        "ajax_edit_personal_data",
                        Icon("building"),
                        [
                            "name",
                            "name_addition",
                        ],
                    ),
                    person_metadata(models.LegalPerson),
                ),
                common_tiles(request),
            ), ),
    )