Intervention template adjustments
* renames intervention variable to obj to match other template style * renames open routes to detail routes
This commit is contained in:
		
							parent
							
								
									83378f27c1
								
							
						
					
					
						commit
						af0fe655b3
					
				@ -12,7 +12,7 @@ urlpatterns = [
 | 
			
		||||
    path("", index_view, name="acc-index"),
 | 
			
		||||
    path('new/', new_view, name='acc-new'),
 | 
			
		||||
    path('new/id', new_id_view, name='acc-new-id'),
 | 
			
		||||
    path('<id>', open_view, name='acc-open'),
 | 
			
		||||
    path('<id>', detail_view, name='acc-detail'),
 | 
			
		||||
    path('<id>/log', log_view, name='acc-log'),
 | 
			
		||||
    path('<id>/record', record_view, name='acc-record'),
 | 
			
		||||
    path('<id>/edit', edit_view, name='acc-edit'),
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@ urlpatterns = [
 | 
			
		||||
    path('new/id', new_id_view, name='new-id'),
 | 
			
		||||
    path('new/<intervention_id>', new_view, name='new'),
 | 
			
		||||
    path('new', new_view, name='new'),
 | 
			
		||||
    path('<id>', open_view, name='open'),
 | 
			
		||||
    path('<id>', detail_view, name='detail'),
 | 
			
		||||
    path('<id>/log', log_view, name='log'),
 | 
			
		||||
    path('<id>/edit', edit_view, name='edit'),
 | 
			
		||||
    path('<id>/remove', remove_view, name='remove'),
 | 
			
		||||
 | 
			
		||||
@ -179,7 +179,7 @@ class NewCompensationForm(AbstractCompensationForm):
 | 
			
		||||
            self.initialize_form_field("intervention", intervention_id)
 | 
			
		||||
            self.disable_form_field("intervention")
 | 
			
		||||
            self.action_url = reverse("compensation:new", args=(intervention_id,))
 | 
			
		||||
            self.cancel_redirect = reverse("intervention:open", args=(intervention_id,))
 | 
			
		||||
            self.cancel_redirect = reverse("intervention:detail", args=(intervention_id,))
 | 
			
		||||
        else:
 | 
			
		||||
            self.action_url = reverse("compensation:new")
 | 
			
		||||
            self.cancel_redirect = reverse("compensation:index")
 | 
			
		||||
@ -230,7 +230,7 @@ class EditCompensationForm(NewCompensationForm):
 | 
			
		||||
        super().__init__(*args, **kwargs)
 | 
			
		||||
        self.form_title = _("Edit compensation")
 | 
			
		||||
        self.action_url = reverse("compensation:edit", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("compensation:open", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("compensation:detail", args=(self.instance.id,))
 | 
			
		||||
 | 
			
		||||
        # Initialize form data
 | 
			
		||||
        form_data = {
 | 
			
		||||
@ -384,7 +384,7 @@ class EditEcoAccountForm(NewEcoAccountForm):
 | 
			
		||||
        self.form_title = _("Edit Eco-Account")
 | 
			
		||||
 | 
			
		||||
        self.action_url = reverse("compensation:acc-edit", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("compensation:acc-open", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("compensation:acc-detail", args=(self.instance.id,))
 | 
			
		||||
 | 
			
		||||
        # Initialize form data
 | 
			
		||||
        form_data = {
 | 
			
		||||
 | 
			
		||||
@ -82,7 +82,7 @@ class CompensationTable(BaseTable):
 | 
			
		||||
        html = ""
 | 
			
		||||
        html += self.render_link(
 | 
			
		||||
            tooltip=_("Open {}").format(_("Compensation")),
 | 
			
		||||
            href=reverse("compensation:open", args=(record.id,)),
 | 
			
		||||
            href=reverse("compensation:detail", args=(record.id,)),
 | 
			
		||||
            txt=value,
 | 
			
		||||
            new_tab=False,
 | 
			
		||||
        )
 | 
			
		||||
@ -223,7 +223,7 @@ class EcoAccountTable(BaseTable):
 | 
			
		||||
        html = ""
 | 
			
		||||
        html += self.render_link(
 | 
			
		||||
            tooltip=_("Open {}").format(_("Eco-account")),
 | 
			
		||||
            href=reverse("compensation:acc-open", args=(record.id,)),
 | 
			
		||||
            href=reverse("compensation:acc-detail", args=(record.id,)),
 | 
			
		||||
            txt=value,
 | 
			
		||||
            new_tab=False,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,7 @@
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th scope="row">{% trans 'compensates intervention' %}</th>
 | 
			
		||||
                        <td class="align-middle">
 | 
			
		||||
                            <a href="{% url 'intervention:open' obj.intervention.id %}">
 | 
			
		||||
                            <a href="{% url 'intervention:detail' obj.intervention.id %}">
 | 
			
		||||
                                {{obj.intervention.identifier}}
 | 
			
		||||
                            </a>
 | 
			
		||||
                        </td>
 | 
			
		||||
 | 
			
		||||
@ -45,7 +45,7 @@
 | 
			
		||||
            {% for deduction in deductions %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td class="align-middle">
 | 
			
		||||
                    <a href="{% url 'intervention:open' deduction.intervention.id %}">
 | 
			
		||||
                    <a href="{% url 'intervention:detail' deduction.intervention.id %}">
 | 
			
		||||
                        {{ deduction.intervention.identifier }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                </td>
 | 
			
		||||
 | 
			
		||||
@ -74,7 +74,7 @@ def new_view(request: HttpRequest, intervention_id: str = None):
 | 
			
		||||
                    )
 | 
			
		||||
                )
 | 
			
		||||
            messages.success(request, _("Compensation {} added").format(comp.identifier))
 | 
			
		||||
            return redirect("compensation:open", id=comp.id)
 | 
			
		||||
            return redirect("compensation:detail", id=comp.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -129,7 +129,7 @@ def edit_view(request: HttpRequest, id: str):
 | 
			
		||||
            # The data form takes the geom form for processing, as well as the performing user
 | 
			
		||||
            comp = data_form.save(request.user, geom_form)
 | 
			
		||||
            messages.success(request, _("Compensation {} edited").format(comp.identifier))
 | 
			
		||||
            return redirect("compensation:open", id=comp.id)
 | 
			
		||||
            return redirect("compensation:detail", id=comp.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -145,7 +145,7 @@ def edit_view(request: HttpRequest, id: str):
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
@any_group_check
 | 
			
		||||
def open_view(request: HttpRequest, id: str):
 | 
			
		||||
def detail_view(request: HttpRequest, id: str):
 | 
			
		||||
    """ Renders a detail view for a compensation
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
 | 
			
		||||
@ -84,7 +84,7 @@ def new_view(request: HttpRequest):
 | 
			
		||||
                    )
 | 
			
		||||
                )
 | 
			
		||||
            messages.success(request, _("Eco-Account {} added").format(acc.identifier))
 | 
			
		||||
            return redirect("compensation:acc-open", id=acc.id)
 | 
			
		||||
            return redirect("compensation:acc-detail", id=acc.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -139,7 +139,7 @@ def edit_view(request: HttpRequest, id: str):
 | 
			
		||||
            # The data form takes the geom form for processing, as well as the performing user
 | 
			
		||||
            acc = data_form.save(request.user, geom_form)
 | 
			
		||||
            messages.success(request, _("Eco-Account {} edited").format(acc.identifier))
 | 
			
		||||
            return redirect("compensation:acc-open", id=acc.id)
 | 
			
		||||
            return redirect("compensation:acc-detail", id=acc.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -155,7 +155,7 @@ def edit_view(request: HttpRequest, id: str):
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
@any_group_check
 | 
			
		||||
def open_view(request: HttpRequest, id: str):
 | 
			
		||||
def detail_view(request: HttpRequest, id: str):
 | 
			
		||||
    """ Renders a detail view for a compensation
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
 | 
			
		||||
@ -99,7 +99,7 @@ class EditEmaForm(NewEmaForm):
 | 
			
		||||
        self.form_title = _("Edit EMA")
 | 
			
		||||
 | 
			
		||||
        self.action_url = reverse("ema:edit", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("ema:open", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("ema:detail", args=(self.instance.id,))
 | 
			
		||||
 | 
			
		||||
        self.fields["identifier"].widget.attrs["url"] = reverse_lazy("ema:new-id")
 | 
			
		||||
        self.fields["title"].widget.attrs["placeholder"] = _("Compensation XY; Location ABC")
 | 
			
		||||
 | 
			
		||||
@ -80,7 +80,7 @@ class EmaTable(BaseTable):
 | 
			
		||||
        html = ""
 | 
			
		||||
        html += self.render_link(
 | 
			
		||||
            tooltip=_("Open {}").format(_("EMA")),
 | 
			
		||||
            href=reverse("ema:open", args=(record.id,)),
 | 
			
		||||
            href=reverse("ema:detail", args=(record.id,)),
 | 
			
		||||
            txt=value,
 | 
			
		||||
            new_tab=False,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@ urlpatterns = [
 | 
			
		||||
    path("", index_view, name="index"),
 | 
			
		||||
    path("new/", new_view, name="new"),
 | 
			
		||||
    path("new/id", new_id_view, name="new-id"),
 | 
			
		||||
    path("<id>", open_view, name="open"),
 | 
			
		||||
    path("<id>", detail_view, name="detail"),
 | 
			
		||||
    path('<id>/log', log_view, name='log'),
 | 
			
		||||
    path('<id>/edit', edit_view, name='edit'),
 | 
			
		||||
    path('<id>/remove', remove_view, name='remove'),
 | 
			
		||||
 | 
			
		||||
@ -75,7 +75,7 @@ def new_view(request: HttpRequest):
 | 
			
		||||
                    )
 | 
			
		||||
                )
 | 
			
		||||
            messages.success(request, _("EMA {} added").format(ema.identifier))
 | 
			
		||||
            return redirect("ema:open", id=ema.id)
 | 
			
		||||
            return redirect("ema:detail", id=ema.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -108,7 +108,7 @@ def new_id_view(request: HttpRequest):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
def open_view(request: HttpRequest, id: str):
 | 
			
		||||
def detail_view(request: HttpRequest, id: str):
 | 
			
		||||
    """ Renders the detail view of an EMA
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
@ -199,7 +199,7 @@ def edit_view(request: HttpRequest, id: str):
 | 
			
		||||
            # The data form takes the geom form for processing, as well as the performing user
 | 
			
		||||
            ema = data_form.save(request.user, geom_form)
 | 
			
		||||
            messages.success(request, _("EMA {} edited").format(ema.identifier))
 | 
			
		||||
            return redirect("ema:open", id=ema.id)
 | 
			
		||||
            return redirect("ema:detail", id=ema.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
 | 
			
		||||
@ -269,7 +269,7 @@ class EditInterventionForm(NewInterventionForm):
 | 
			
		||||
        super().__init__(*args, **kwargs)
 | 
			
		||||
        if self.instance is not None:
 | 
			
		||||
            self.action_url = reverse("intervention:edit", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("intervention:open", args=(self.instance.id,))
 | 
			
		||||
        self.cancel_redirect = reverse("intervention:detail", args=(self.instance.id,))
 | 
			
		||||
        self.form_title = _("Edit intervention")
 | 
			
		||||
        self.form_caption = ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -86,7 +86,7 @@ class InterventionTable(BaseTable):
 | 
			
		||||
        html = ""
 | 
			
		||||
        html += self.render_link(
 | 
			
		||||
            tooltip=_("Open {}").format(_("Intervention")),
 | 
			
		||||
            href=reverse("intervention:open", args=(record.id,)),
 | 
			
		||||
            href=reverse("intervention:detail", args=(record.id,)),
 | 
			
		||||
            txt=value,
 | 
			
		||||
            new_tab=False,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
{% load i18n fontawesome_5 %}
 | 
			
		||||
 | 
			
		||||
{% if intervention.comment %}
 | 
			
		||||
{% if obj.comment %}
 | 
			
		||||
<div class="w-100">
 | 
			
		||||
    <div class="card mt-3">
 | 
			
		||||
        <div class="card-header rlp-gd">
 | 
			
		||||
@ -15,7 +15,7 @@
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="card-body">
 | 
			
		||||
            <div class="card-text font-italic">
 | 
			
		||||
                {{intervention.comment}}
 | 
			
		||||
                {{obj.comment}}
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <div class="d-flex justify-content-end">
 | 
			
		||||
                    {% if is_default_member and has_access  %}
 | 
			
		||||
                    <a href="{% url 'compensation:new' intervention.id %}" title="{% trans 'Add new compensation' %}">
 | 
			
		||||
                    <a href="{% url 'compensation:new' obj.id %}" title="{% trans 'Add new compensation' %}">
 | 
			
		||||
                        <button class="btn btn-outline-default">
 | 
			
		||||
                            {% fa5_icon 'plus' %}
 | 
			
		||||
                            {% fa5_icon 'leaf' %}
 | 
			
		||||
@ -41,7 +41,7 @@
 | 
			
		||||
            {% for comp in compensations %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td class="align-middle">
 | 
			
		||||
                    <a href="{% url 'compensation:open' comp.id %}">
 | 
			
		||||
                    <a href="{% url 'compensation:detail' comp.id %}">
 | 
			
		||||
                        {{ comp.identifier }}
 | 
			
		||||
                    </a>
 | 
			
		||||
                </td>
 | 
			
		||||
 | 
			
		||||
@ -12,35 +12,35 @@
 | 
			
		||||
        </button>
 | 
			
		||||
    </a>
 | 
			
		||||
    {% if has_access %}
 | 
			
		||||
        <button class="btn btn-default btn-modal mr-2" title="{% trans 'Share' %}" data-form-url="{% url 'intervention:share-create' intervention.id %}">
 | 
			
		||||
        <button class="btn btn-default btn-modal mr-2" title="{% trans 'Share' %}" data-form-url="{% url 'intervention:share-create' obj.id %}">
 | 
			
		||||
            {% fa5_icon 'share-alt' %}
 | 
			
		||||
        </button>
 | 
			
		||||
        {% if is_zb_member %}
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" title="{% trans 'Run check' %}" data-form-url="{% url 'intervention:run-check' intervention.id %}">
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" title="{% trans 'Run check' %}" data-form-url="{% url 'intervention:run-check' obj.id %}">
 | 
			
		||||
                {% fa5_icon 'star' %}
 | 
			
		||||
            </button>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
        {% if is_ets_member %}
 | 
			
		||||
            {% if intervention.recorded %}
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" title="{% trans 'Unrecord' %}" data-form-url="{% url 'intervention:record' intervention.id %}">
 | 
			
		||||
            {% if obj.recorded %}
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" title="{% trans 'Unrecord' %}" data-form-url="{% url 'intervention:record' obj.id %}">
 | 
			
		||||
                {% fa5_icon 'bookmark' 'far' %}
 | 
			
		||||
            </button>
 | 
			
		||||
            {% else %}
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" title="{% trans 'Record' %}" data-form-url="{% url 'intervention:record' intervention.id %}">
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" title="{% trans 'Record' %}" data-form-url="{% url 'intervention:record' obj.id %}">
 | 
			
		||||
                {% fa5_icon 'bookmark' %}
 | 
			
		||||
            </button>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
        {% if is_default_member %}
 | 
			
		||||
            <a href="{% url 'intervention:edit' intervention.id %}" class="mr-2">
 | 
			
		||||
            <a href="{% url 'intervention:edit' obj.id %}" class="mr-2">
 | 
			
		||||
                <button class="btn btn-default" title="{% trans 'Edit' %}">
 | 
			
		||||
                    {% fa5_icon 'edit' %}
 | 
			
		||||
                </button>
 | 
			
		||||
            </a>
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'intervention:log' intervention.id %}" title="{% trans 'Show log' %}">
 | 
			
		||||
            <button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'intervention:log' obj.id %}" title="{% trans 'Show log' %}">
 | 
			
		||||
                {% fa5_icon 'history' %}
 | 
			
		||||
            </button>
 | 
			
		||||
            <button class="btn btn-default btn-modal" data-form-url="{% url 'intervention:remove' intervention.id %}" title="{% trans 'Delete' %}">
 | 
			
		||||
            <button class="btn btn-default btn-modal" data-form-url="{% url 'intervention:remove' obj.id %}" title="{% trans 'Delete' %}">
 | 
			
		||||
                {% fa5_icon 'trash' %}
 | 
			
		||||
            </button>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
 | 
			
		||||
@ -4,14 +4,14 @@
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <h5>
 | 
			
		||||
                    <span class="badge badge-light">{{intervention.deductions.count}}</span>
 | 
			
		||||
                    <span class="badge badge-light">{{obj.deductions.count}}</span>
 | 
			
		||||
                    {% trans 'Eco Account Deductions' %}
 | 
			
		||||
                </h5>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <div class="d-flex justify-content-end">
 | 
			
		||||
                    {% if is_default_member and has_access  %}
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:acc-new-deduction' intervention.id %}" title="{% trans 'Add new deduction' %}">
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:acc-new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
 | 
			
		||||
                        {% fa5_icon 'plus' %}
 | 
			
		||||
                        {% fa5_icon 'tree' %}
 | 
			
		||||
                    </button>
 | 
			
		||||
@ -39,10 +39,10 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
            <tbody>
 | 
			
		||||
            {% for deduction in intervention.deductions.all %}
 | 
			
		||||
            {% for deduction in obj.deductions.all %}
 | 
			
		||||
            <tr {% if deduction.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Deduction invalid!' %}" {% elif not deduction.account.recorded %}class="align-middle alert-danger" title="{% trans 'Eco-account not recorded! Deduction invalid!' %}"  {% endif %}>
 | 
			
		||||
                <td class="align-middle">
 | 
			
		||||
                    <a href="{% url 'compensation:acc-open' deduction.account.id %}">
 | 
			
		||||
                    <a href="{% url 'compensation:acc-detail' deduction.account.id %}">
 | 
			
		||||
                        {% if deduction.account.deleted or not deduction.account.recorded %}
 | 
			
		||||
                        {% fa5_icon 'exclamation-triangle' %}
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
 | 
			
		||||
@ -4,14 +4,14 @@
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <h5>
 | 
			
		||||
                    <span class="badge badge-light">{{intervention.documents.count}}</span>
 | 
			
		||||
                    <span class="badge badge-light">{{obj.documents.count}}</span>
 | 
			
		||||
                    {% trans 'Documents' %}
 | 
			
		||||
                </h5>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <div class="d-flex justify-content-end">
 | 
			
		||||
                    {% if is_default_member and has_access  %}
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-doc' intervention.id %}" title="{% trans 'Add new document' %}">
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
 | 
			
		||||
                        {% fa5_icon 'plus' %}
 | 
			
		||||
                        {% fa5_icon 'file' %}
 | 
			
		||||
                    </button>
 | 
			
		||||
@ -36,7 +36,7 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
            <tbody>
 | 
			
		||||
            {% for doc in intervention.documents.all %}
 | 
			
		||||
            {% for doc in obj.documents.all %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td class="align-middle">
 | 
			
		||||
                    <a href="{% url 'intervention:get-doc' doc.id %}">
 | 
			
		||||
 | 
			
		||||
@ -4,14 +4,14 @@
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <h5>
 | 
			
		||||
                    <span class="badge badge-light">{{intervention.payments.count}}</span>
 | 
			
		||||
                    <span class="badge badge-light">{{obj.payments.count}}</span>
 | 
			
		||||
                    {% trans 'Payments' %}
 | 
			
		||||
                </h5>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <div class="d-flex justify-content-end">
 | 
			
		||||
                    {% if is_default_member and has_access  %}
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay-new' intervention.id %}" title="{% trans 'Add new payment' %}">
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay-new' obj.id %}" title="{% trans 'Add new payment' %}">
 | 
			
		||||
                        {% fa5_icon 'plus' %}
 | 
			
		||||
                        {% fa5_icon 'money-bill-wave' %}
 | 
			
		||||
                    </button>
 | 
			
		||||
@ -39,7 +39,7 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
            <tbody>
 | 
			
		||||
            {% for pay in intervention.payments.all %}
 | 
			
		||||
            {% for pay in obj.payments.all %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td class="align-middle">
 | 
			
		||||
                    {{ pay.amount|floatformat:2 }} €
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
        <div class="row">
 | 
			
		||||
            <div class="col-sm-6">
 | 
			
		||||
                <h5>
 | 
			
		||||
                    <span class="badge badge-light">{% if intervention.legal.revocation %}1{% else %}0{% endif %}</span>
 | 
			
		||||
                    <span class="badge badge-light">{% if obj.legal.revocation %}1{% else %}0{% endif %}</span>
 | 
			
		||||
                    {% trans 'Revocation' %}
 | 
			
		||||
                </h5>
 | 
			
		||||
            </div>
 | 
			
		||||
@ -13,8 +13,8 @@
 | 
			
		||||
                    {% comment %}
 | 
			
		||||
                        Only show add-button if no revocation exists, yet.
 | 
			
		||||
                    {% endcomment %}
 | 
			
		||||
                    {% if is_default_member and has_access and not intervention.legal.revocation %}
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-revocation' intervention.id %}" title="{% trans 'Add revocation' %}">
 | 
			
		||||
                    {% if is_default_member and has_access and not obj.legal.revocation %}
 | 
			
		||||
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-revocation' obj.id %}" title="{% trans 'Add revocation' %}">
 | 
			
		||||
                        {% fa5_icon 'plus' %}
 | 
			
		||||
                        {% fa5_icon 'ban' %}
 | 
			
		||||
                    </button>
 | 
			
		||||
@ -42,8 +42,8 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
            <tbody>
 | 
			
		||||
            {% if intervention.legal.revocation %}
 | 
			
		||||
            {% with intervention.legal.revocation as rev %}
 | 
			
		||||
            {% if obj.legal.revocation %}
 | 
			
		||||
            {% with obj.legal.revocation as rev %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td class="align-middle">
 | 
			
		||||
                    {{ rev.date }}
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@
 | 
			
		||||
 | 
			
		||||
    <div id="detail-header" class="row">
 | 
			
		||||
        <div class="col-sm-12 col-md-12 col-lg-6">
 | 
			
		||||
            <h3>{% trans 'Intervention' %}<br> {{intervention.identifier}}</h3>
 | 
			
		||||
            <h3>{% trans 'Intervention' %}<br> {{obj.identifier}}</h3>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col-sm-12 col-md-12 col-lg-6">
 | 
			
		||||
            {% include 'intervention/detail/includes/controls.html' %}
 | 
			
		||||
@ -26,52 +26,52 @@
 | 
			
		||||
        <div class="col-sm-12 col-md-12 col-lg-6">
 | 
			
		||||
            <div class="table-container">
 | 
			
		||||
                <table class="table table-hover">
 | 
			
		||||
                    <tr {% if not intervention.title %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.title %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th class="w-25" scope="row">{% trans 'Title' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.title|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.title|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.legal.process_type %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.legal.process_type %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Process type' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.legal.process_type|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.legal.process_type|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if intervention.legal.laws.count == 0 %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if obj.legal.laws.count == 0 %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Law' %}</th>
 | 
			
		||||
                        <td class="align-middle">
 | 
			
		||||
                            {% for law in intervention.legal.laws.all %}
 | 
			
		||||
                            {% for law in obj.legal.laws.all %}
 | 
			
		||||
                                <div class="badge pill-badge rlp-r-outline">{{law.short_name}} - {{law.long_name}}</div>
 | 
			
		||||
                                <br>
 | 
			
		||||
                            {% endfor %}
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.responsible.registration_office %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.responsible.registration_office %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Registration office' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.responsible.registration_office.str_as_office|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.responsible.registration_office.str_as_office|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.responsible.registration_file_number %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.responsible.registration_file_number %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Registration office file number' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.responsible.registration_file_number|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.responsible.registration_file_number|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.responsible.conservation_office %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.responsible.conservation_office %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Conservation office' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.responsible.conservation_office.str_as_office|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.responsible.conservation_office.str_as_office|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.responsible.conservation_file_number %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.responsible.conservation_file_number %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Conservation office file number' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.responsible.conservation_file_number|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.responsible.conservation_file_number|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.responsible.handler %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.responsible.handler %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Intervention handler' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.responsible.handler|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.responsible.handler|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th scope="row">{% trans 'Checked' %}</th>
 | 
			
		||||
                        <td class="align-middle">
 | 
			
		||||
                            {% if intervention.checked is None %}
 | 
			
		||||
                            {% if obj.checked is None %}
 | 
			
		||||
                                <span>
 | 
			
		||||
                                    {% fa5_icon 'star' 'far' %}
 | 
			
		||||
                                </span>
 | 
			
		||||
                            {% else %}
 | 
			
		||||
                                <span class="check-star" title="{% trans 'Checked on '%} {{intervention.checked.timestamp}} {% trans 'by' %} {{intervention.checked.user}}">
 | 
			
		||||
                                <span class="check-star" title="{% trans 'Checked on '%} {{obj.checked.timestamp}} {% trans 'by' %} {{obj.checked.user}}">
 | 
			
		||||
                                    {% fa5_icon 'star' %}
 | 
			
		||||
                                </span>
 | 
			
		||||
                            {% endif %}
 | 
			
		||||
@ -80,41 +80,41 @@
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th scope="row">{% trans 'Recorded' %}</th>
 | 
			
		||||
                        <td class="align-middle">
 | 
			
		||||
                            {% if intervention.recorded is None %}
 | 
			
		||||
                            {% if obj.recorded is None %}
 | 
			
		||||
                                <span title="{% trans 'Not recorded yet' %}">
 | 
			
		||||
                                    {% fa5_icon 'bookmark' 'far' %}
 | 
			
		||||
                                </span>
 | 
			
		||||
                            {% else %}
 | 
			
		||||
                                <span class="registered-bookmark" title="{% trans 'Recorded on '%} {{intervention.recorded.timestamp}} {% trans 'by' %} {{intervention.recorded.user}}">
 | 
			
		||||
                                <span class="registered-bookmark" title="{% trans 'Recorded on '%} {{obj.recorded.timestamp}} {% trans 'by' %} {{obj.recorded.user}}">
 | 
			
		||||
                                    {% fa5_icon 'bookmark' %}
 | 
			
		||||
                                </span>
 | 
			
		||||
                            {% endif %}
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.legal.registration_date %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.legal.registration_date %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Registration date' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.legal.registration_date|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.legal.registration_date|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if not intervention.legal.binding_date %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if not obj.legal.binding_date %}class="alert alert-danger" title="{% trans 'Missing' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Binding on' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.legal.binding_date|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.legal.binding_date|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr {% if intervention.legal.revocation %}class="alert alert-danger" title="{% trans 'Exists' %}" {% endif %}>
 | 
			
		||||
                    <tr {% if obj.legal.revocation %}class="alert alert-danger" title="{% trans 'Exists' %}" {% endif %}>
 | 
			
		||||
                        <th scope="row">{% trans 'Revocation' %}</th>
 | 
			
		||||
                        <td class="align-middle">{{intervention.legal.revocation.date|naturalday|default_if_none:""}}</td>
 | 
			
		||||
                        <td class="align-middle">{{obj.legal.revocation.date|naturalday|default_if_none:""}}</td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th scope="row">{% trans 'Last modified' %}</th>
 | 
			
		||||
                        <td class="align-middle">
 | 
			
		||||
                            {{intervention.created.timestamp|default_if_none:""|naturalday}}
 | 
			
		||||
                            {{obj.created.timestamp|default_if_none:""|naturalday}}
 | 
			
		||||
                            <br>
 | 
			
		||||
                            {{intervention.created.user.username}}
 | 
			
		||||
                            {{obj.created.user.username}}
 | 
			
		||||
                        </td>
 | 
			
		||||
                    </tr>
 | 
			
		||||
                    <tr>
 | 
			
		||||
                        <th scope="row">{% trans 'Shared with' %}</th>
 | 
			
		||||
                        <td class="align-middle">
 | 
			
		||||
                            {% for user in intervention.users.all %}
 | 
			
		||||
                            {% for user in obj.users.all %}
 | 
			
		||||
                                {% include 'user/includes/contact_modal_button.html' %}
 | 
			
		||||
                            {% endfor %}
 | 
			
		||||
                        </td>
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ Created on: 30.11.20
 | 
			
		||||
"""
 | 
			
		||||
from django.urls import path
 | 
			
		||||
 | 
			
		||||
from intervention.views import index_view, new_view, open_view, edit_view, remove_view, new_document_view, share_view, \
 | 
			
		||||
from intervention.views import index_view, new_view, detail_view, edit_view, remove_view, new_document_view, share_view, \
 | 
			
		||||
    create_share_view, remove_revocation_view, new_revocation_view, run_check_view, log_view, new_deduction_view, \
 | 
			
		||||
    record_view, remove_document_view, get_document_view, get_revocation_view, new_id_view
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@ urlpatterns = [
 | 
			
		||||
    path("", index_view, name="index"),
 | 
			
		||||
    path('new/', new_view, name='new'),
 | 
			
		||||
    path('new/id', new_id_view, name='new-id'),
 | 
			
		||||
    path('<id>', open_view, name='open'),
 | 
			
		||||
    path('<id>', detail_view, name='detail'),
 | 
			
		||||
    path('<id>/log', log_view, name='log'),
 | 
			
		||||
    path('<id>/edit', edit_view, name='edit'),
 | 
			
		||||
    path('<id>/remove', remove_view, name='remove'),
 | 
			
		||||
 | 
			
		||||
@ -74,7 +74,7 @@ def new_view(request: HttpRequest):
 | 
			
		||||
                    )
 | 
			
		||||
                )
 | 
			
		||||
            messages.success(request, _("Intervention {} added").format(intervention.identifier))
 | 
			
		||||
            return redirect("intervention:open", id=intervention.id)
 | 
			
		||||
            return redirect("intervention:detail", id=intervention.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -180,7 +180,7 @@ def remove_document_view(request: HttpRequest, doc_id: str):
 | 
			
		||||
 | 
			
		||||
@login_required
 | 
			
		||||
@any_group_check
 | 
			
		||||
def open_view(request: HttpRequest, id: str):
 | 
			
		||||
def detail_view(request: HttpRequest, id: str):
 | 
			
		||||
    """ Renders a detail view for viewing an intervention's data
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
@ -213,7 +213,7 @@ def open_view(request: HttpRequest, id: str):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    context = {
 | 
			
		||||
        "intervention": intervention,
 | 
			
		||||
        "obj": intervention,
 | 
			
		||||
        "compensations": compensations,
 | 
			
		||||
        "has_access": is_data_shared,
 | 
			
		||||
        "geom_form": geom_form,
 | 
			
		||||
@ -252,7 +252,7 @@ def edit_view(request: HttpRequest, id: str):
 | 
			
		||||
            # The data form takes the geom form for processing, as well as the performing user
 | 
			
		||||
            intervention = data_form.save(request.user, geom_form)
 | 
			
		||||
            messages.success(request, _("Intervention {} edited").format(intervention.identifier))
 | 
			
		||||
            return redirect("intervention:open", id=intervention.id)
 | 
			
		||||
            return redirect("intervention:detail", id=intervention.id)
 | 
			
		||||
        else:
 | 
			
		||||
            messages.error(request, FORM_INVALID)
 | 
			
		||||
    else:
 | 
			
		||||
@ -338,7 +338,7 @@ def share_view(request: HttpRequest, id: str, token: str):
 | 
			
		||||
                _("{} has been shared with you").format(intervention.identifier)
 | 
			
		||||
            )
 | 
			
		||||
            intervention.users.add(user)
 | 
			
		||||
        return redirect("intervention:open", id=id)
 | 
			
		||||
        return redirect("intervention:detail", id=id)
 | 
			
		||||
    else:
 | 
			
		||||
        messages.error(
 | 
			
		||||
            request,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user